Выносим error code в отдельный класс
This commit is contained in:
@@ -58,10 +58,6 @@ public class Defines {
|
|||||||
public final static int PRINT_HIGH = 2; // critical messages
|
public final static int PRINT_HIGH = 2; // critical messages
|
||||||
public final static int PRINT_CHAT = 3; // chat messages
|
public final static int PRINT_CHAT = 3; // chat messages
|
||||||
|
|
||||||
public final static int ERR_FATAL = 0; // exit the entire game with a popup window
|
|
||||||
public final static int ERR_DROP = 1; // print to console and disconnect from game
|
|
||||||
public final static int ERR_DISCONNECT = 2; // don't kill server
|
|
||||||
|
|
||||||
public final static int PRINT_ALL = 0;
|
public final static int PRINT_ALL = 0;
|
||||||
public final static int PRINT_DEVELOPER = 1; // only print when "developer 1"
|
public final static int PRINT_DEVELOPER = 1; // only print when "developer 1"
|
||||||
|
|
||||||
|
|||||||
7
src/main/java/lwjake2/ErrorCode.java
Normal file
7
src/main/java/lwjake2/ErrorCode.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package lwjake2;
|
||||||
|
|
||||||
|
public class ErrorCode {
|
||||||
|
public final static int ERR_FATAL = 0; // exit the entire game with a popup window
|
||||||
|
public final static int ERR_DROP = 1; // print to console and disconnect from game
|
||||||
|
public final static int ERR_DISCONNECT = 2; // don't kill server
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ package lwjake2.client;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.EndianHandler;
|
import lwjake2.game.EndianHandler;
|
||||||
@@ -359,7 +360,7 @@ public final class CL {
|
|||||||
NET.SendPacket(Defines.NS_CLIENT, b.length(), Lib.stringToBytes(b), to);
|
NET.SendPacket(Defines.NS_CLIENT, b.length(), Lib.stringToBytes(b), to);
|
||||||
};
|
};
|
||||||
|
|
||||||
static Runnable Disconnect_f = () -> Com.Error(Defines.ERR_DROP, "Disconnected from server");
|
static Runnable Disconnect_f = () -> Com.Error(ErrorCode.ERR_DROP, "Disconnected from server");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changing_f
|
* Changing_f
|
||||||
@@ -1150,7 +1151,7 @@ public final class CL {
|
|||||||
.atoi(Globals.cl.configstrings[Defines.CS_MAPCHECKSUM])) != 0) {
|
.atoi(Globals.cl.configstrings[Defines.CS_MAPCHECKSUM])) != 0) {
|
||||||
Com
|
Com
|
||||||
.Error(
|
.Error(
|
||||||
Defines.ERR_DROP,
|
ErrorCode.ERR_DROP,
|
||||||
"Local map version differs from server: "
|
"Local map version differs from server: "
|
||||||
+ map_checksum
|
+ map_checksum
|
||||||
+ " != '"
|
+ " != '"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.client;
|
package lwjake2.client;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.entity_state_t;
|
import lwjake2.game.entity_state_t;
|
||||||
import lwjake2.game.player_state_t;
|
import lwjake2.game.player_state_t;
|
||||||
@@ -261,10 +262,10 @@ public class CL_ents {
|
|||||||
bits = iw[0];
|
bits = iw[0];
|
||||||
|
|
||||||
if (newnum >= Defines.MAX_EDICTS)
|
if (newnum >= Defines.MAX_EDICTS)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParsePacketEntities: bad number:" + newnum);
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParsePacketEntities: bad number:" + newnum);
|
||||||
|
|
||||||
if (Globals.net_message.readcount > Globals.net_message.cursize)
|
if (Globals.net_message.readcount > Globals.net_message.cursize)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParsePacketEntities: end of message");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParsePacketEntities: end of message");
|
||||||
|
|
||||||
if (0 == newnum)
|
if (0 == newnum)
|
||||||
break;
|
break;
|
||||||
@@ -544,14 +545,14 @@ public class CL_ents {
|
|||||||
cmd = MSG.ReadByte(Globals.net_message);
|
cmd = MSG.ReadByte(Globals.net_message);
|
||||||
CL_parse.SHOWNET(CL_parse.svc_strings[cmd]);
|
CL_parse.SHOWNET(CL_parse.svc_strings[cmd]);
|
||||||
if (cmd != Defines.svc_playerinfo)
|
if (cmd != Defines.svc_playerinfo)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseFrame: not playerinfo");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseFrame: not playerinfo");
|
||||||
ParsePlayerstate(old, Globals.cl.frame);
|
ParsePlayerstate(old, Globals.cl.frame);
|
||||||
|
|
||||||
// read packet entities
|
// read packet entities
|
||||||
cmd = MSG.ReadByte(Globals.net_message);
|
cmd = MSG.ReadByte(Globals.net_message);
|
||||||
CL_parse.SHOWNET(CL_parse.svc_strings[cmd]);
|
CL_parse.SHOWNET(CL_parse.svc_strings[cmd]);
|
||||||
if (cmd != Defines.svc_packetentities)
|
if (cmd != Defines.svc_packetentities)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseFrame: not packetentities");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseFrame: not packetentities");
|
||||||
|
|
||||||
ParsePacketEntities(old, Globals.cl.frame);
|
ParsePacketEntities(old, Globals.cl.frame);
|
||||||
|
|
||||||
@@ -1205,7 +1206,7 @@ public class CL_ents {
|
|||||||
centity_t old;
|
centity_t old;
|
||||||
|
|
||||||
if (ent < 0 || ent >= Defines.MAX_EDICTS)
|
if (ent < 0 || ent >= Defines.MAX_EDICTS)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_GetEntitySoundOrigin: bad ent");
|
Com.Error(ErrorCode.ERR_DROP, "CL_GetEntitySoundOrigin: bad ent");
|
||||||
old = Globals.cl_entities[ent];
|
old = Globals.cl_entities[ent];
|
||||||
Math3D.VectorCopy(old.lerp_origin, org);
|
Math3D.VectorCopy(old.lerp_origin, org);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.client;
|
package lwjake2.client;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.entity_state_t;
|
import lwjake2.game.entity_state_t;
|
||||||
import lwjake2.game.monsters.M_Flash;
|
import lwjake2.game.monsters.M_Flash;
|
||||||
@@ -161,7 +162,7 @@ public class CL_fx {
|
|||||||
|
|
||||||
j = s.length();
|
j = s.length();
|
||||||
if (j >= Defines.MAX_QPATH)
|
if (j >= Defines.MAX_QPATH)
|
||||||
Com.Error(Defines.ERR_DROP, "svc_lightstyle length=" + j);
|
Com.Error(ErrorCode.ERR_DROP, "svc_lightstyle length=" + j);
|
||||||
|
|
||||||
cl_lightstyle[i].length = j;
|
cl_lightstyle[i].length = j;
|
||||||
|
|
||||||
@@ -257,7 +258,7 @@ public class CL_fx {
|
|||||||
|
|
||||||
int i = MSG.ReadShort(Globals.net_message);
|
int i = MSG.ReadShort(Globals.net_message);
|
||||||
if (i < 1 || i >= Defines.MAX_EDICTS)
|
if (i < 1 || i >= Defines.MAX_EDICTS)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
|
||||||
|
|
||||||
int weapon = MSG.ReadByte(Globals.net_message);
|
int weapon = MSG.ReadByte(Globals.net_message);
|
||||||
int silenced = weapon & Defines.MZ_SILENCED;
|
int silenced = weapon & Defines.MZ_SILENCED;
|
||||||
@@ -510,7 +511,7 @@ public class CL_fx {
|
|||||||
|
|
||||||
int ent = MSG.ReadShort(Globals.net_message);
|
int ent = MSG.ReadShort(Globals.net_message);
|
||||||
if (ent < 1 || ent >= Defines.MAX_EDICTS)
|
if (ent < 1 || ent >= Defines.MAX_EDICTS)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
|
||||||
|
|
||||||
int flash_number = MSG.ReadByte(Globals.net_message);
|
int flash_number = MSG.ReadByte(Globals.net_message);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.client;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.entity_state_t;
|
import lwjake2.game.entity_state_t;
|
||||||
@@ -308,7 +309,7 @@ public class CL_parse {
|
|||||||
// BIG HACK to let demos from release work with the 3.0x patch!!!
|
// BIG HACK to let demos from release work with the 3.0x patch!!!
|
||||||
if (Globals.server_state != 0) {
|
if (Globals.server_state != 0) {
|
||||||
} else if (i != Defines.PROTOCOL_VERSION)
|
} else if (i != Defines.PROTOCOL_VERSION)
|
||||||
Com.Error(Defines.ERR_DROP, "Server returned version " + i
|
Com.Error(ErrorCode.ERR_DROP, "Server returned version " + i
|
||||||
+ ", not " + Defines.PROTOCOL_VERSION);
|
+ ", not " + Defines.PROTOCOL_VERSION);
|
||||||
|
|
||||||
Globals.cl.servercount = MSG.ReadLong(Globals.net_message);
|
Globals.cl.servercount = MSG.ReadLong(Globals.net_message);
|
||||||
@@ -420,7 +421,7 @@ public class CL_parse {
|
|||||||
pos = s.indexOf('/');
|
pos = s.indexOf('/');
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
Com.Error(Defines.ERR_FATAL, "Invalid model name:" + s);
|
Com.Error(ErrorCode.ERR_FATAL, "Invalid model name:" + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
model_name = s.substring(0, pos);
|
model_name = s.substring(0, pos);
|
||||||
@@ -524,7 +525,7 @@ public class CL_parse {
|
|||||||
i = MSG.ReadShort(Globals.net_message);
|
i = MSG.ReadShort(Globals.net_message);
|
||||||
|
|
||||||
if (i < 0 || i >= Defines.MAX_CONFIGSTRINGS)
|
if (i < 0 || i >= Defines.MAX_CONFIGSTRINGS)
|
||||||
Com.Error(Defines.ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
|
Com.Error(ErrorCode.ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
|
||||||
|
|
||||||
s = MSG.ReadString(Globals.net_message);
|
s = MSG.ReadString(Globals.net_message);
|
||||||
|
|
||||||
@@ -610,7 +611,7 @@ public class CL_parse {
|
|||||||
channel = MSG.ReadShort(Globals.net_message);
|
channel = MSG.ReadShort(Globals.net_message);
|
||||||
ent = channel >> 3;
|
ent = channel >> 3;
|
||||||
if (ent > Defines.MAX_EDICTS)
|
if (ent > Defines.MAX_EDICTS)
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseStartSoundPacket: ent = "
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseStartSoundPacket: ent = "
|
||||||
+ ent);
|
+ ent);
|
||||||
|
|
||||||
channel &= 7;
|
channel &= 7;
|
||||||
@@ -660,7 +661,7 @@ public class CL_parse {
|
|||||||
//
|
//
|
||||||
while (true) {
|
while (true) {
|
||||||
if (Globals.net_message.readcount > Globals.net_message.cursize) {
|
if (Globals.net_message.readcount > Globals.net_message.cursize) {
|
||||||
Com.Error(Defines.ERR_FATAL,
|
Com.Error(ErrorCode.ERR_FATAL,
|
||||||
"CL_ParseServerMessage: Bad server message:");
|
"CL_ParseServerMessage: Bad server message:");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -683,7 +684,7 @@ public class CL_parse {
|
|||||||
// other commands
|
// other commands
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
Com.Error(Defines.ERR_DROP,
|
Com.Error(ErrorCode.ERR_DROP,
|
||||||
"CL_ParseServerMessage: Illegible server message\n");
|
"CL_ParseServerMessage: Illegible server message\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -692,7 +693,7 @@ public class CL_parse {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Defines.svc_disconnect:
|
case Defines.svc_disconnect:
|
||||||
Com.Error(Defines.ERR_DISCONNECT, "Server disconnected\n");
|
Com.Error(ErrorCode.ERR_DISCONNECT, "Server disconnected\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Defines.svc_reconnect:
|
case Defines.svc_reconnect:
|
||||||
@@ -787,7 +788,7 @@ public class CL_parse {
|
|||||||
case Defines.svc_playerinfo:
|
case Defines.svc_playerinfo:
|
||||||
case Defines.svc_packetentities:
|
case Defines.svc_packetentities:
|
||||||
case Defines.svc_deltapacketentities:
|
case Defines.svc_deltapacketentities:
|
||||||
Com.Error(Defines.ERR_DROP, "Out of place frame data");
|
Com.Error(ErrorCode.ERR_DROP, "Out of place frame data");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.client;
|
package lwjake2.client;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.player_state_t;
|
import lwjake2.game.player_state_t;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
@@ -1286,7 +1287,7 @@ public class CL_tent {
|
|||||||
// ==============
|
// ==============
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Com.Error(Defines.ERR_DROP, "CL_ParseTEnt: bad type");
|
Com.Error(ErrorCode.ERR_DROP, "CL_ParseTEnt: bad type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.client;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.qcommon.Cbuf;
|
import lwjake2.qcommon.Cbuf;
|
||||||
@@ -348,7 +349,7 @@ public class Key extends Globals {
|
|||||||
Menu.Menu_Main_f();
|
Menu.Menu_Main_f();
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
Com.Error(Defines.ERR_FATAL, "Bad cls.key_dest");
|
Com.Error(ErrorCode.ERR_FATAL, "Bad cls.key_dest");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -424,7 +425,7 @@ public class Key extends Globals {
|
|||||||
Key.Console(key);
|
Key.Console(key);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
Com.Error(Defines.ERR_FATAL, "Bad cls.key_dest");
|
Com.Error(ErrorCode.ERR_FATAL, "Bad cls.key_dest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ import java.io.RandomAccessFile;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static lwjake2.ErrorCode.ERR_DROP;
|
||||||
|
import static lwjake2.ErrorCode.ERR_FATAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu
|
* Menu
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import java.nio.ByteBuffer;
|
|||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static lwjake2.ErrorCode.ERR_DROP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SCR
|
* SCR
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import lwjake2.util.Math3D;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
import static lwjake2.ErrorCode.ERR_DROP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V
|
* V
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.client;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.cvar_t;
|
import lwjake2.game.cvar_t;
|
||||||
@@ -203,13 +204,13 @@ public class VID extends Globals {
|
|||||||
|
|
||||||
if (Globals.re == null)
|
if (Globals.re == null)
|
||||||
{
|
{
|
||||||
Com.Error(Defines.ERR_FATAL, name + " can't load but registered");
|
Com.Error(ErrorCode.ERR_FATAL, name + " can't load but registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Globals.re.apiVersion() != Defines.API_VERSION)
|
if (Globals.re.apiVersion() != Defines.API_VERSION)
|
||||||
{
|
{
|
||||||
FreeReflib();
|
FreeReflib();
|
||||||
Com.Error(Defines.ERR_FATAL, name + " has incompatible api_version");
|
Com.Error(ErrorCode.ERR_FATAL, name + " has incompatible api_version");
|
||||||
}
|
}
|
||||||
|
|
||||||
IN.Real_IN_Init();
|
IN.Real_IN_Init();
|
||||||
@@ -276,9 +277,9 @@ public class VID extends Globals {
|
|||||||
log.info("Trying mode 0");
|
log.info("Trying mode 0");
|
||||||
Cvar.SetValue("gl_mode", 0);
|
Cvar.SetValue("gl_mode", 0);
|
||||||
if ( !LoadRefresh( vid_ref.string ) )
|
if ( !LoadRefresh( vid_ref.string ) )
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!");
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!");
|
||||||
} else
|
} else
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!");
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Cvar.Set("vid_ref", renderer);
|
Cvar.Set("vid_ref", renderer);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.game;
|
package lwjake2.game;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.qcommon.CM;
|
import lwjake2.qcommon.CM;
|
||||||
import lwjake2.qcommon.Cbuf;
|
import lwjake2.qcommon.Cbuf;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
@@ -72,7 +73,7 @@ public class game_import_t {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void error(String err) {
|
public void error(String err) {
|
||||||
Com.Error(Defines.ERR_FATAL, err);
|
Com.Error(ErrorCode.ERR_FATAL, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(int level, String err) {
|
public void error(int level, String err) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.qcommon;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.cvar_t;
|
import lwjake2.game.cvar_t;
|
||||||
@@ -189,7 +190,7 @@ public class BaseQ2FileSystem implements FileSystem {
|
|||||||
// open a new file on the pakfile
|
// open a new file on the pakfile
|
||||||
File file = new File(pak.filename);
|
File file = new File(pak.filename);
|
||||||
if (!file.canRead()) {
|
if (!file.canRead()) {
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't reopen "
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't reopen "
|
||||||
+ pak.filename);
|
+ pak.filename);
|
||||||
}
|
}
|
||||||
return entry.filelen;
|
return entry.filelen;
|
||||||
@@ -260,7 +261,7 @@ public class BaseQ2FileSystem implements FileSystem {
|
|||||||
// filename + '\n');
|
// filename + '\n');
|
||||||
file = new File(pak.filename);
|
file = new File(pak.filename);
|
||||||
if (!file.canRead())
|
if (!file.canRead())
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't reopen "
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't reopen "
|
||||||
+ pak.filename);
|
+ pak.filename);
|
||||||
if (pak.handle == null || !pak.handle.getFD().valid()) {
|
if (pak.handle == null || !pak.handle.getFD().valid()) {
|
||||||
// hold the pakfile handle open
|
// hold the pakfile handle open
|
||||||
@@ -360,7 +361,7 @@ public class BaseQ2FileSystem implements FileSystem {
|
|||||||
file.readFully(buf);
|
file.readFully(buf);
|
||||||
file.close();
|
file.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Com.Error(Defines.ERR_FATAL, e.toString());
|
Com.Error(ErrorCode.ERR_FATAL, e.toString());
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -422,7 +423,7 @@ public class BaseQ2FileSystem implements FileSystem {
|
|||||||
// filename + '\n');
|
// filename + '\n');
|
||||||
file = new File(pak.filename);
|
file = new File(pak.filename);
|
||||||
if (!file.canRead())
|
if (!file.canRead())
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't reopen "
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't reopen "
|
||||||
+ pak.filename);
|
+ pak.filename);
|
||||||
if (pak.handle == null || !pak.handle.getFD().valid()) {
|
if (pak.handle == null || !pak.handle.getFD().valid()) {
|
||||||
// hold the pakfile handle open
|
// hold the pakfile handle open
|
||||||
@@ -513,12 +514,12 @@ public class BaseQ2FileSystem implements FileSystem {
|
|||||||
header.dirlen = packhandle.getInt();
|
header.dirlen = packhandle.getInt();
|
||||||
|
|
||||||
if (header.ident != IDPAKHEADER)
|
if (header.ident != IDPAKHEADER)
|
||||||
Com.Error(Defines.ERR_FATAL, packfile + " is not a packfile");
|
Com.Error(ErrorCode.ERR_FATAL, packfile + " is not a packfile");
|
||||||
|
|
||||||
numpackfiles = header.dirlen / packfile_t.SIZE;
|
numpackfiles = header.dirlen / packfile_t.SIZE;
|
||||||
|
|
||||||
if (numpackfiles > MAX_FILES_IN_PACK)
|
if (numpackfiles > MAX_FILES_IN_PACK)
|
||||||
Com.Error(Defines.ERR_FATAL, packfile + " has " + numpackfiles
|
Com.Error(ErrorCode.ERR_FATAL, packfile + " has " + numpackfiles
|
||||||
+ " files");
|
+ " files");
|
||||||
|
|
||||||
newfiles = new Hashtable<>(numpackfiles);
|
newfiles = new Hashtable<>(numpackfiles);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.qcommon;
|
package lwjake2.qcommon;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.cmodel_t;
|
import lwjake2.game.cmodel_t;
|
||||||
import lwjake2.game.cplane_t;
|
import lwjake2.game.cplane_t;
|
||||||
@@ -252,7 +253,7 @@ public class CM {
|
|||||||
buf = fileSystem.loadFile(name);
|
buf = fileSystem.loadFile(name);
|
||||||
|
|
||||||
if (buf == null)
|
if (buf == null)
|
||||||
Com.Error(Defines.ERR_DROP, "Couldn't load " + name);
|
Com.Error(ErrorCode.ERR_DROP, "Couldn't load " + name);
|
||||||
|
|
||||||
length = buf.length;
|
length = buf.length;
|
||||||
|
|
||||||
@@ -264,7 +265,7 @@ public class CM {
|
|||||||
header = new qfiles.dheader_t(bbuf.slice());
|
header = new qfiles.dheader_t(bbuf.slice());
|
||||||
|
|
||||||
if (header.version != Defines.BSPVERSION)
|
if (header.version != Defines.BSPVERSION)
|
||||||
Com.Error(Defines.ERR_DROP, "CMod_LoadBrushModel: " + name
|
Com.Error(ErrorCode.ERR_DROP, "CMod_LoadBrushModel: " + name
|
||||||
+ " has wrong version number (" + header.version
|
+ " has wrong version number (" + header.version
|
||||||
+ " should be " + Defines.BSPVERSION + ")");
|
+ " should be " + Defines.BSPVERSION + ")");
|
||||||
|
|
||||||
@@ -304,14 +305,14 @@ public class CM {
|
|||||||
int i, j, count;
|
int i, j, count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dmodel_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dmodel_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "CMod_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "CMod_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / qfiles.dmodel_t.SIZE;
|
count = l.filelen / qfiles.dmodel_t.SIZE;
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map with no models");
|
Com.Error(ErrorCode.ERR_DROP, "Map with no models");
|
||||||
if (count > Defines.MAX_MAP_MODELS)
|
if (count > Defines.MAX_MAP_MODELS)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many models");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many models");
|
||||||
|
|
||||||
Com.DPrintf(" numcmodels=" + count + "\n");
|
Com.DPrintf(" numcmodels=" + count + "\n");
|
||||||
numcmodels = count;
|
numcmodels = count;
|
||||||
@@ -354,13 +355,13 @@ public class CM {
|
|||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if ((l.filelen % texinfo_t.SIZE) != 0)
|
if ((l.filelen % texinfo_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / texinfo_t.SIZE;
|
count = l.filelen / texinfo_t.SIZE;
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map with no surfaces");
|
Com.Error(ErrorCode.ERR_DROP, "Map with no surfaces");
|
||||||
if (count > Defines.MAX_MAP_TEXINFO)
|
if (count > Defines.MAX_MAP_TEXINFO)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many surfaces");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many surfaces");
|
||||||
|
|
||||||
numtexinfo = count;
|
numtexinfo = count;
|
||||||
Com.DPrintf(" numtexinfo=" + count + "\n");
|
Com.DPrintf(" numtexinfo=" + count + "\n");
|
||||||
@@ -395,14 +396,14 @@ public class CM {
|
|||||||
int i, j, count;
|
int i, j, count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dnode_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dnode_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size:"
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size:"
|
||||||
+ l.fileofs + "," + qfiles.dnode_t.SIZE);
|
+ l.fileofs + "," + qfiles.dnode_t.SIZE);
|
||||||
count = l.filelen / qfiles.dnode_t.SIZE;
|
count = l.filelen / qfiles.dnode_t.SIZE;
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has no nodes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has no nodes");
|
||||||
if (count > Defines.MAX_MAP_NODES)
|
if (count > Defines.MAX_MAP_NODES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many nodes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many nodes");
|
||||||
|
|
||||||
numnodes = count;
|
numnodes = count;
|
||||||
Com.DPrintf(" numnodes=" + count + "\n");
|
Com.DPrintf(" numnodes=" + count + "\n");
|
||||||
@@ -436,12 +437,12 @@ public class CM {
|
|||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dbrush_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dbrush_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / qfiles.dbrush_t.SIZE;
|
count = l.filelen / qfiles.dbrush_t.SIZE;
|
||||||
|
|
||||||
if (count > Defines.MAX_MAP_BRUSHES)
|
if (count > Defines.MAX_MAP_BRUSHES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many brushes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many brushes");
|
||||||
|
|
||||||
numbrushes = count;
|
numbrushes = count;
|
||||||
Com.DPrintf(" numbrushes=" + count + "\n");
|
Com.DPrintf(" numbrushes=" + count + "\n");
|
||||||
@@ -474,16 +475,16 @@ public class CM {
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dleaf_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dleaf_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / qfiles.dleaf_t.SIZE;
|
count = l.filelen / qfiles.dleaf_t.SIZE;
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map with no leafs");
|
Com.Error(ErrorCode.ERR_DROP, "Map with no leafs");
|
||||||
|
|
||||||
// need to save space for box planes
|
// need to save space for box planes
|
||||||
if (count > Defines.MAX_MAP_PLANES)
|
if (count > Defines.MAX_MAP_PLANES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many planes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many planes");
|
||||||
|
|
||||||
Com.DPrintf(" numleafes=" + count + "\n");
|
Com.DPrintf(" numleafes=" + count + "\n");
|
||||||
|
|
||||||
@@ -517,7 +518,7 @@ public class CM {
|
|||||||
Com.DPrintf(" numclusters=" + numclusters + "\n");
|
Com.DPrintf(" numclusters=" + numclusters + "\n");
|
||||||
|
|
||||||
if (map_leafs[0].contents != Defines.CONTENTS_SOLID)
|
if (map_leafs[0].contents != Defines.CONTENTS_SOLID)
|
||||||
Com.Error(Defines.ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID");
|
Com.Error(ErrorCode.ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID");
|
||||||
|
|
||||||
solidleaf = 0;
|
solidleaf = 0;
|
||||||
emptyleaf = -1;
|
emptyleaf = -1;
|
||||||
@@ -530,7 +531,7 @@ public class CM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (emptyleaf == -1)
|
if (emptyleaf == -1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map does not have an empty leaf");
|
Com.Error(ErrorCode.ERR_DROP, "Map does not have an empty leaf");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads planes. */
|
/** Loads planes. */
|
||||||
@@ -543,16 +544,16 @@ public class CM {
|
|||||||
int bits;
|
int bits;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / qfiles.dplane_t.SIZE;
|
count = l.filelen / qfiles.dplane_t.SIZE;
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map with no planes");
|
Com.Error(ErrorCode.ERR_DROP, "Map with no planes");
|
||||||
|
|
||||||
// need to save space for box planes
|
// need to save space for box planes
|
||||||
if (count > Defines.MAX_MAP_PLANES)
|
if (count > Defines.MAX_MAP_PLANES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many planes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many planes");
|
||||||
|
|
||||||
Com.DPrintf(" numplanes=" + count + "\n");
|
Com.DPrintf(" numplanes=" + count + "\n");
|
||||||
|
|
||||||
@@ -597,18 +598,18 @@ public class CM {
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
if ((l.filelen % 2) != 0)
|
if ((l.filelen % 2) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / 2;
|
count = l.filelen / 2;
|
||||||
|
|
||||||
Com.DPrintf(" numbrushes=" + count + "\n");
|
Com.DPrintf(" numbrushes=" + count + "\n");
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_DROP, "Map with no planes");
|
Com.Error(ErrorCode.ERR_DROP, "Map with no planes");
|
||||||
|
|
||||||
// need to save space for box planes
|
// need to save space for box planes
|
||||||
if (count > Defines.MAX_MAP_LEAFBRUSHES)
|
if (count > Defines.MAX_MAP_LEAFBRUSHES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many leafbrushes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many leafbrushes");
|
||||||
|
|
||||||
out = map_leafbrushes;
|
out = map_leafbrushes;
|
||||||
numleafbrushes = count;
|
numleafbrushes = count;
|
||||||
@@ -638,12 +639,12 @@ public class CM {
|
|||||||
int num;
|
int num;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dbrushside_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dbrushside_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
count = l.filelen / qfiles.dbrushside_t.SIZE;
|
count = l.filelen / qfiles.dbrushside_t.SIZE;
|
||||||
|
|
||||||
// need to save space for box planes
|
// need to save space for box planes
|
||||||
if (count > Defines.MAX_MAP_BRUSHSIDES)
|
if (count > Defines.MAX_MAP_BRUSHSIDES)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many planes");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many planes");
|
||||||
|
|
||||||
numbrushsides = count;
|
numbrushsides = count;
|
||||||
|
|
||||||
@@ -667,7 +668,7 @@ public class CM {
|
|||||||
j = in.texinfo;
|
j = in.texinfo;
|
||||||
|
|
||||||
if (j >= numtexinfo)
|
if (j >= numtexinfo)
|
||||||
Com.Error(Defines.ERR_DROP, "Bad brushside texinfo");
|
Com.Error(ErrorCode.ERR_DROP, "Bad brushside texinfo");
|
||||||
|
|
||||||
// java specific handling of -1
|
// java specific handling of -1
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
@@ -690,12 +691,12 @@ public class CM {
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.darea_t.SIZE) != 0)
|
if ((l.filelen % qfiles.darea_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
|
|
||||||
count = l.filelen / qfiles.darea_t.SIZE;
|
count = l.filelen / qfiles.darea_t.SIZE;
|
||||||
|
|
||||||
if (count > Defines.MAX_MAP_AREAS)
|
if (count > Defines.MAX_MAP_AREAS)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many areas");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many areas");
|
||||||
|
|
||||||
Com.DPrintf(" numareas=" + count + "\n");
|
Com.DPrintf(" numareas=" + count + "\n");
|
||||||
numareas = count;
|
numareas = count;
|
||||||
@@ -730,11 +731,11 @@ public class CM {
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dareaportal_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dareaportal_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size");
|
||||||
count = l.filelen / qfiles.dareaportal_t.SIZE;
|
count = l.filelen / qfiles.dareaportal_t.SIZE;
|
||||||
|
|
||||||
if (count > Defines.MAX_MAP_AREAS)
|
if (count > Defines.MAX_MAP_AREAS)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too many areas");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too many areas");
|
||||||
|
|
||||||
numareaportals = count;
|
numareaportals = count;
|
||||||
Com.DPrintf(" numareaportals=" + count + "\n");
|
Com.DPrintf(" numareaportals=" + count + "\n");
|
||||||
@@ -767,7 +768,7 @@ public class CM {
|
|||||||
Com.DPrintf(" numvisibility=" + numvisibility + "\n");
|
Com.DPrintf(" numvisibility=" + numvisibility + "\n");
|
||||||
|
|
||||||
if (l.filelen > Defines.MAX_MAP_VISIBILITY)
|
if (l.filelen > Defines.MAX_MAP_VISIBILITY)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too large visibility lump");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too large visibility lump");
|
||||||
|
|
||||||
System.arraycopy(cmod_base, l.fileofs, map_visibility, 0, l.filelen);
|
System.arraycopy(cmod_base, l.fileofs, map_visibility, 0, l.filelen);
|
||||||
|
|
||||||
@@ -785,7 +786,7 @@ public class CM {
|
|||||||
numentitychars = l.filelen;
|
numentitychars = l.filelen;
|
||||||
|
|
||||||
if (l.filelen > Defines.MAX_MAP_ENTSTRING)
|
if (l.filelen > Defines.MAX_MAP_ENTSTRING)
|
||||||
Com.Error(Defines.ERR_DROP, "Map has too large entity lump");
|
Com.Error(ErrorCode.ERR_DROP, "Map has too large entity lump");
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for (; x < l.filelen && cmod_base[x + l.fileofs] != 0; x++);
|
for (; x < l.filelen && cmod_base[x + l.fileofs] != 0; x++);
|
||||||
@@ -801,12 +802,12 @@ public class CM {
|
|||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (name == null || name.charAt(0) != '*')
|
if (name == null || name.charAt(0) != '*')
|
||||||
Com.Error(Defines.ERR_DROP, "CM_InlineModel: bad name");
|
Com.Error(ErrorCode.ERR_DROP, "CM_InlineModel: bad name");
|
||||||
|
|
||||||
num = Lib.atoi(name.substring(1));
|
num = Lib.atoi(name.substring(1));
|
||||||
|
|
||||||
if (num < 1 || num >= numcmodels)
|
if (num < 1 || num >= numcmodels)
|
||||||
Com.Error(Defines.ERR_DROP, "CM_InlineModel: bad number");
|
Com.Error(ErrorCode.ERR_DROP, "CM_InlineModel: bad number");
|
||||||
|
|
||||||
return map_cmodels[num];
|
return map_cmodels[num];
|
||||||
}
|
}
|
||||||
@@ -825,19 +826,19 @@ public class CM {
|
|||||||
|
|
||||||
public static int CM_LeafContents(int leafnum) {
|
public static int CM_LeafContents(int leafnum) {
|
||||||
if (leafnum < 0 || leafnum >= numleafs)
|
if (leafnum < 0 || leafnum >= numleafs)
|
||||||
Com.Error(Defines.ERR_DROP, "CM_LeafContents: bad number");
|
Com.Error(ErrorCode.ERR_DROP, "CM_LeafContents: bad number");
|
||||||
return map_leafs[leafnum].contents;
|
return map_leafs[leafnum].contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CM_LeafCluster(int leafnum) {
|
public static int CM_LeafCluster(int leafnum) {
|
||||||
if (leafnum < 0 || leafnum >= numleafs)
|
if (leafnum < 0 || leafnum >= numleafs)
|
||||||
Com.Error(Defines.ERR_DROP, "CM_LeafCluster: bad number");
|
Com.Error(ErrorCode.ERR_DROP, "CM_LeafCluster: bad number");
|
||||||
return map_leafs[leafnum].cluster;
|
return map_leafs[leafnum].cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CM_LeafArea(int leafnum) {
|
public static int CM_LeafArea(int leafnum) {
|
||||||
if (leafnum < 0 || leafnum >= numleafs)
|
if (leafnum < 0 || leafnum >= numleafs)
|
||||||
Com.Error(Defines.ERR_DROP, "CM_LeafArea: bad number");
|
Com.Error(ErrorCode.ERR_DROP, "CM_LeafArea: bad number");
|
||||||
return map_leafs[leafnum].area;
|
return map_leafs[leafnum].area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +875,7 @@ public class CM {
|
|||||||
|| numleafbrushes + 1 > Defines.MAX_MAP_LEAFBRUSHES
|
|| numleafbrushes + 1 > Defines.MAX_MAP_LEAFBRUSHES
|
||||||
|| numbrushsides + 6 > Defines.MAX_MAP_BRUSHSIDES
|
|| numbrushsides + 6 > Defines.MAX_MAP_BRUSHSIDES
|
||||||
|| numplanes + 12 > Defines.MAX_MAP_PLANES)
|
|| numplanes + 12 > Defines.MAX_MAP_PLANES)
|
||||||
Com.Error(Defines.ERR_DROP, "Not enough room for box tree");
|
Com.Error(ErrorCode.ERR_DROP, "Not enough room for box tree");
|
||||||
|
|
||||||
box_brush = map_brushes[numbrushes];
|
box_brush = map_brushes[numbrushes];
|
||||||
box_brush.numsides = 6;
|
box_brush.numsides = 6;
|
||||||
@@ -1655,7 +1656,7 @@ public class CM {
|
|||||||
if (area.floodvalid == floodvalid) {
|
if (area.floodvalid == floodvalid) {
|
||||||
if (area.floodnum == floodnum)
|
if (area.floodnum == floodnum)
|
||||||
return;
|
return;
|
||||||
Com.Error(Defines.ERR_DROP, "FloodArea_r: reflooded");
|
Com.Error(ErrorCode.ERR_DROP, "FloodArea_r: reflooded");
|
||||||
}
|
}
|
||||||
|
|
||||||
area.floodnum = floodnum;
|
area.floodnum = floodnum;
|
||||||
@@ -1699,7 +1700,7 @@ public class CM {
|
|||||||
*/
|
*/
|
||||||
public static void CM_SetAreaPortalState(int portalnum, boolean open) {
|
public static void CM_SetAreaPortalState(int portalnum, boolean open) {
|
||||||
if (portalnum > numareaportals)
|
if (portalnum > numareaportals)
|
||||||
Com.Error(Defines.ERR_DROP, "areaportal > numareaportals");
|
Com.Error(ErrorCode.ERR_DROP, "areaportal > numareaportals");
|
||||||
|
|
||||||
portalopen[portalnum] = open;
|
portalopen[portalnum] = open;
|
||||||
FloodAreaConnections();
|
FloodAreaConnections();
|
||||||
@@ -1714,7 +1715,7 @@ public class CM {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (area1 > numareas || area2 > numareas)
|
if (area1 > numareas || area2 > numareas)
|
||||||
Com.Error(Defines.ERR_DROP, "area > numareas");
|
Com.Error(ErrorCode.ERR_DROP, "area > numareas");
|
||||||
|
|
||||||
if (map_areas[area1].floodnum == map_areas[area2].floodnum)
|
if (map_areas[area1].floodnum == map_areas[area2].floodnum)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.qcommon;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.util.Lib;
|
import lwjake2.util.Lib;
|
||||||
@@ -216,7 +217,7 @@ public final class Cbuf {
|
|||||||
Cbuf.AddText(text);
|
Cbuf.AddText(text);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Com.Error(Defines.ERR_FATAL, "Cbuf_ExecuteText: bad exec_when");
|
Com.Error(ErrorCode.ERR_FATAL, "Cbuf_ExecuteText: bad exec_when");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.qcommon;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.client.CL;
|
import lwjake2.client.CL;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
@@ -238,7 +239,7 @@ public final class Com {
|
|||||||
return new String(com_token, 0, len);
|
return new String(com_token, 0, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Runnable Error_f= () -> Error(Defines.ERR_FATAL, Cmd.Argv(1));
|
public static Runnable Error_f= () -> Error(ErrorCode.ERR_FATAL, Cmd.Argv(1));
|
||||||
|
|
||||||
public static void Error(int code, String fmt) throws IllegalStateException
|
public static void Error(int code, String fmt) throws IllegalStateException
|
||||||
{
|
{
|
||||||
@@ -258,13 +259,13 @@ public final class Com {
|
|||||||
|
|
||||||
msg= sprintf(fmt, vargs);
|
msg= sprintf(fmt, vargs);
|
||||||
|
|
||||||
if (code == Defines.ERR_DISCONNECT)
|
if (code == ErrorCode.ERR_DISCONNECT)
|
||||||
{
|
{
|
||||||
CL.Drop();
|
CL.Drop();
|
||||||
recursive= false;
|
recursive= false;
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
else if (code == Defines.ERR_DROP)
|
else if (code == ErrorCode.ERR_DROP)
|
||||||
{
|
{
|
||||||
Com.Printf("********************\nERROR: " + msg + "\n********************\n");
|
Com.Printf("********************\nERROR: " + msg + "\n********************\n");
|
||||||
SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false);
|
SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false);
|
||||||
@@ -290,7 +291,7 @@ public final class Com {
|
|||||||
|
|
||||||
if (args.length > Defines.MAX_NUM_ARGVS)
|
if (args.length > Defines.MAX_NUM_ARGVS)
|
||||||
{
|
{
|
||||||
Com.Error(Defines.ERR_FATAL, "argc > MAX_NUM_ARGVS");
|
Com.Error(ErrorCode.ERR_FATAL, "argc > MAX_NUM_ARGVS");
|
||||||
}
|
}
|
||||||
|
|
||||||
Com.com_argc= args.length;
|
Com.com_argc= args.length;
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ import lwjake2.game.usercmd_t;
|
|||||||
import lwjake2.util.Lib;
|
import lwjake2.util.Lib;
|
||||||
import lwjake2.util.Math3D;
|
import lwjake2.util.Math3D;
|
||||||
|
|
||||||
|
import static lwjake2.ErrorCode.ERR_DROP;
|
||||||
|
import static lwjake2.ErrorCode.ERR_FATAL;
|
||||||
|
|
||||||
public class MSG extends Globals {
|
public class MSG extends Globals {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.qcommon;
|
package lwjake2.qcommon;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.util.Lib;
|
import lwjake2.util.Lib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,10 +50,10 @@ public final class SZ {
|
|||||||
|
|
||||||
if (buf.cursize + length > buf.maxsize) {
|
if (buf.cursize + length > buf.maxsize) {
|
||||||
if (!buf.allowoverflow)
|
if (!buf.allowoverflow)
|
||||||
Com.Error(Defines.ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set");
|
Com.Error(ErrorCode.ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set");
|
||||||
|
|
||||||
if (length > buf.maxsize)
|
if (length > buf.maxsize)
|
||||||
Com.Error(Defines.ERR_FATAL, "SZ_GetSpace: " + length + " is > full buffer size");
|
Com.Error(ErrorCode.ERR_FATAL, "SZ_GetSpace: " + length + " is > full buffer size");
|
||||||
|
|
||||||
Com.Printf("SZ_GetSpace: overflow\n");
|
Com.Printf("SZ_GetSpace: overflow\n");
|
||||||
Clear(buf);
|
Clear(buf);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.client.VID;
|
import lwjake2.client.VID;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
import lwjake2.render.image_t;
|
import lwjake2.render.image_t;
|
||||||
@@ -247,7 +248,7 @@ public abstract class Draw extends Image {
|
|||||||
protected void Draw_Fill(int x, int y, int w, int h, int colorIndex) {
|
protected void Draw_Fill(int x, int y, int w, int h, int colorIndex) {
|
||||||
|
|
||||||
if ( colorIndex > 255)
|
if ( colorIndex > 255)
|
||||||
Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color");
|
Com.Error(ErrorCode.ERR_FATAL, "Draw_Fill: bad color");
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.client.VID;
|
import lwjake2.client.VID;
|
||||||
import lwjake2.client.particle_t;
|
import lwjake2.client.particle_t;
|
||||||
import lwjake2.game.cvar_t;
|
import lwjake2.game.cvar_t;
|
||||||
@@ -555,10 +556,10 @@ public abstract class Image extends Main {
|
|||||||
targa_header = new qfiles.tga_t(raw);
|
targa_header = new qfiles.tga_t(raw);
|
||||||
|
|
||||||
if (targa_header.image_type != 2 && targa_header.image_type != 10)
|
if (targa_header.image_type != 2 && targa_header.image_type != 10)
|
||||||
Com.Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n");
|
Com.Error(ErrorCode.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n");
|
||||||
|
|
||||||
if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24))
|
if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24))
|
||||||
Com.Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n");
|
Com.Error (ErrorCode.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n");
|
||||||
|
|
||||||
columns = targa_header.width;
|
columns = targa_header.width;
|
||||||
rows = targa_header.height;
|
rows = targa_header.height;
|
||||||
@@ -1092,7 +1093,7 @@ public abstract class Image extends Main {
|
|||||||
upload_height = scaled_height;
|
upload_height = scaled_height;
|
||||||
|
|
||||||
if (scaled_width * scaled_height > 256 * 256)
|
if (scaled_width * scaled_height > 256 * 256)
|
||||||
Com.Error(Defines.ERR_DROP, "GL_Upload32: too big");
|
Com.Error(ErrorCode.ERR_DROP, "GL_Upload32: too big");
|
||||||
|
|
||||||
// scan the texture for any non-255 alpha
|
// scan the texture for any non-255 alpha
|
||||||
c = width * height;
|
c = width * height;
|
||||||
@@ -1252,7 +1253,7 @@ public abstract class Image extends Main {
|
|||||||
int s = width * height;
|
int s = width * height;
|
||||||
|
|
||||||
if (s > trans.length)
|
if (s > trans.length)
|
||||||
Com.Error(Defines.ERR_DROP, "GL_Upload8: too large");
|
Com.Error(ErrorCode.ERR_DROP, "GL_Upload8: too large");
|
||||||
|
|
||||||
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) {
|
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) {
|
||||||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL11.GL_COLOR_INDEX, GL11.GL_UNSIGNED_BYTE, ByteBuffer.wrap(data));
|
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL11.GL_COLOR_INDEX, GL11.GL_UNSIGNED_BYTE, ByteBuffer.wrap(data));
|
||||||
@@ -1318,14 +1319,14 @@ public abstract class Image extends Main {
|
|||||||
if (i == numgltextures)
|
if (i == numgltextures)
|
||||||
{
|
{
|
||||||
if (numgltextures == MAX_GLTEXTURES)
|
if (numgltextures == MAX_GLTEXTURES)
|
||||||
Com.Error (Defines.ERR_DROP, "MAX_GLTEXTURES");
|
Com.Error (ErrorCode.ERR_DROP, "MAX_GLTEXTURES");
|
||||||
|
|
||||||
numgltextures++;
|
numgltextures++;
|
||||||
}
|
}
|
||||||
image = gltextures[i];
|
image = gltextures[i];
|
||||||
|
|
||||||
if (name.length() > Defines.MAX_QPATH)
|
if (name.length() > Defines.MAX_QPATH)
|
||||||
Com.Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long");
|
Com.Error(ErrorCode.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long");
|
||||||
|
|
||||||
image.name = name;
|
image.name = name;
|
||||||
image.registration_sequence = registration_sequence;
|
image.registration_sequence = registration_sequence;
|
||||||
@@ -1571,7 +1572,7 @@ public abstract class Image extends Main {
|
|||||||
LoadPCX("pics/colormap.pcx", palette, new Dimension());
|
LoadPCX("pics/colormap.pcx", palette, new Dimension());
|
||||||
|
|
||||||
if (palette[0] == null || palette[0].length != 768)
|
if (palette[0] == null || palette[0].length != 768)
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx");
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't load pics/colormap.pcx");
|
||||||
|
|
||||||
byte[] pal = palette[0];
|
byte[] pal = palette[0];
|
||||||
|
|
||||||
@@ -1613,7 +1614,7 @@ public abstract class Image extends Main {
|
|||||||
if (qglColorTableEXT) {
|
if (qglColorTableEXT) {
|
||||||
gl_state.d_16to8table = fileSystem.loadFile("pics/16to8.dat");
|
gl_state.d_16to8table = fileSystem.loadFile("pics/16to8.dat");
|
||||||
if (gl_state.d_16to8table == null)
|
if (gl_state.d_16to8table == null)
|
||||||
Com.Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx");
|
Com.Error(ErrorCode.ERR_FATAL, "Couldn't load pics/16to8.pcx");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gl_config.renderer & (GL_RENDERER_VOODOO | GL_RENDERER_VOODOO2)) != 0) {
|
if ((gl_config.renderer & (GL_RENDERER_VOODOO | GL_RENDERER_VOODOO2)) != 0) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.client.dlight_t;
|
import lwjake2.client.dlight_t;
|
||||||
import lwjake2.game.cplane_t;
|
import lwjake2.game.cplane_t;
|
||||||
@@ -481,14 +482,14 @@ public abstract class Light extends Warp {
|
|||||||
|
|
||||||
if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33
|
if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33
|
||||||
| Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0)
|
| Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0)
|
||||||
Com.Error(Defines.ERR_DROP,
|
Com.Error(ErrorCode.ERR_DROP,
|
||||||
"R_BuildLightMap called for non-lit surface");
|
"R_BuildLightMap called for non-lit surface");
|
||||||
|
|
||||||
int smax = (surf.extents[0] >> 4) + 1;
|
int smax = (surf.extents[0] >> 4) + 1;
|
||||||
int tmax = (surf.extents[1] >> 4) + 1;
|
int tmax = (surf.extents[1] >> 4) + 1;
|
||||||
int size = smax * tmax;
|
int size = smax * tmax;
|
||||||
if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4))
|
if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4))
|
||||||
Com.Error(Defines.ERR_DROP, "Bad s_blocklights size");
|
Com.Error(ErrorCode.ERR_DROP, "Bad s_blocklights size");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// set to full bright if no light data
|
// set to full bright if no light data
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.render.lwjgl;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.client.VID;
|
import lwjake2.client.VID;
|
||||||
import lwjake2.client.entity_t;
|
import lwjake2.client.entity_t;
|
||||||
@@ -417,7 +418,7 @@ public abstract class Main extends Base {
|
|||||||
R_DrawSpriteModel(currententity);
|
R_DrawSpriteModel(currententity);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
Com.Error(Defines.ERR_DROP, "Bad modeltype");
|
Com.Error(ErrorCode.ERR_DROP, "Bad modeltype");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -451,7 +452,7 @@ public abstract class Main extends Base {
|
|||||||
R_DrawSpriteModel(currententity);
|
R_DrawSpriteModel(currententity);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
Com.Error(Defines.ERR_DROP, "Bad modeltype");
|
Com.Error(ErrorCode.ERR_DROP, "Bad modeltype");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -824,11 +825,11 @@ public abstract class Main extends Base {
|
|||||||
|
|
||||||
// included by cwei
|
// included by cwei
|
||||||
if (r_newrefdef == null) {
|
if (r_newrefdef == null) {
|
||||||
Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null");
|
Com.Error(ErrorCode.ERR_DROP, "R_RenderView: refdef_t fd is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0)
|
if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0)
|
||||||
Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel");
|
Com.Error(ErrorCode.ERR_DROP, "R_RenderView: NULL worldmodel");
|
||||||
|
|
||||||
if (r_speeds.value != 0.0f) {
|
if (r_speeds.value != 0.0f) {
|
||||||
c_brush_polys = 0;
|
c_brush_polys = 0;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.client.VID;
|
import lwjake2.client.VID;
|
||||||
import lwjake2.game.cplane_t;
|
import lwjake2.game.cplane_t;
|
||||||
import lwjake2.game.cvar_t;
|
import lwjake2.game.cvar_t;
|
||||||
@@ -85,7 +86,7 @@ public abstract class Model extends Surf {
|
|||||||
cplane_t plane;
|
cplane_t plane;
|
||||||
|
|
||||||
if (model == null || model.nodes == null)
|
if (model == null || model.nodes == null)
|
||||||
Com.Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model");
|
Com.Error (ErrorCode.ERR_DROP, "Mod_PointInLeaf: bad model");
|
||||||
|
|
||||||
node = model.nodes[0]; // root node
|
node = model.nodes[0]; // root node
|
||||||
while (true)
|
while (true)
|
||||||
@@ -224,7 +225,7 @@ public abstract class Model extends Surf {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (name == null || name.length() == 0)
|
if (name == null || name.length() == 0)
|
||||||
Com.Error(Defines.ERR_DROP, "Mod_ForName: NULL name");
|
Com.Error(ErrorCode.ERR_DROP, "Mod_ForName: NULL name");
|
||||||
|
|
||||||
//
|
//
|
||||||
// inline models are grabbed only from worldmodel
|
// inline models are grabbed only from worldmodel
|
||||||
@@ -233,7 +234,7 @@ public abstract class Model extends Surf {
|
|||||||
{
|
{
|
||||||
i = Integer.parseInt(name.substring(1));
|
i = Integer.parseInt(name.substring(1));
|
||||||
if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels)
|
if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels)
|
||||||
Com.Error (Defines.ERR_DROP, "bad inline model number");
|
Com.Error (ErrorCode.ERR_DROP, "bad inline model number");
|
||||||
return mod_inline[i];
|
return mod_inline[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +264,7 @@ public abstract class Model extends Surf {
|
|||||||
if (i == mod_numknown)
|
if (i == mod_numknown)
|
||||||
{
|
{
|
||||||
if (mod_numknown == MAX_MOD_KNOWN)
|
if (mod_numknown == MAX_MOD_KNOWN)
|
||||||
Com.Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN");
|
Com.Error (ErrorCode.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN");
|
||||||
mod_numknown++;
|
mod_numknown++;
|
||||||
mod = mod_known[i];
|
mod = mod_known[i];
|
||||||
}
|
}
|
||||||
@@ -278,7 +279,7 @@ public abstract class Model extends Surf {
|
|||||||
if (fileBuffer == null)
|
if (fileBuffer == null)
|
||||||
{
|
{
|
||||||
if (crash)
|
if (crash)
|
||||||
Com.Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found");
|
Com.Error(ErrorCode.ERR_DROP, "Mod_NumForName: " + mod.name + " not found");
|
||||||
|
|
||||||
mod.name = "";
|
mod.name = "";
|
||||||
return null;
|
return null;
|
||||||
@@ -313,7 +314,7 @@ public abstract class Model extends Surf {
|
|||||||
Mod_LoadBrushModel(mod, bb);
|
Mod_LoadBrushModel(mod, bb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Com.Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name);
|
Com.Error(ErrorCode.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +395,7 @@ public abstract class Model extends Surf {
|
|||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if ( (l.filelen % mvertex_t.DISK_SIZE) != 0)
|
if ( (l.filelen % mvertex_t.DISK_SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / mvertex_t.DISK_SIZE;
|
count = l.filelen / mvertex_t.DISK_SIZE;
|
||||||
|
|
||||||
@@ -437,7 +438,7 @@ public abstract class Model extends Surf {
|
|||||||
void Mod_LoadSubmodels(lump_t l) {
|
void Mod_LoadSubmodels(lump_t l) {
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dmodel_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dmodel_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in "
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in "
|
||||||
+ loadmodel.name);
|
+ loadmodel.name);
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -485,7 +486,7 @@ public abstract class Model extends Surf {
|
|||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if ( (l.filelen % medge_t.DISK_SIZE) != 0)
|
if ( (l.filelen % medge_t.DISK_SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / medge_t.DISK_SIZE;
|
count = l.filelen / medge_t.DISK_SIZE;
|
||||||
// out = Hunk_Alloc ( (count + 1) * sizeof(*out));
|
// out = Hunk_Alloc ( (count + 1) * sizeof(*out));
|
||||||
@@ -518,7 +519,7 @@ public abstract class Model extends Surf {
|
|||||||
String name;
|
String name;
|
||||||
|
|
||||||
if ((l.filelen % texinfo_t.SIZE) != 0)
|
if ((l.filelen % texinfo_t.SIZE) != 0)
|
||||||
Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error (ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / texinfo_t.SIZE;
|
count = l.filelen / texinfo_t.SIZE;
|
||||||
// out = Hunk_Alloc ( count*sizeof(*out));
|
// out = Hunk_Alloc ( count*sizeof(*out));
|
||||||
@@ -628,7 +629,7 @@ public abstract class Model extends Surf {
|
|||||||
int ti;
|
int ti;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dface_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dface_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in "
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in "
|
||||||
+ loadmodel.name);
|
+ loadmodel.name);
|
||||||
|
|
||||||
int count = l.filelen / qfiles.dface_t.SIZE;
|
int count = l.filelen / qfiles.dface_t.SIZE;
|
||||||
@@ -668,7 +669,7 @@ public abstract class Model extends Surf {
|
|||||||
|
|
||||||
ti = in.texinfo;
|
ti = in.texinfo;
|
||||||
if (ti < 0 || ti >= loadmodel.numtexinfo)
|
if (ti < 0 || ti >= loadmodel.numtexinfo)
|
||||||
Com.Error(Defines.ERR_DROP,
|
Com.Error(ErrorCode.ERR_DROP,
|
||||||
"MOD_LoadBmodel: bad texinfo number");
|
"MOD_LoadBmodel: bad texinfo number");
|
||||||
|
|
||||||
out.texinfo = loadmodel.texinfo[ti];
|
out.texinfo = loadmodel.texinfo[ti];
|
||||||
@@ -740,7 +741,7 @@ public abstract class Model extends Surf {
|
|||||||
mnode_t[] out;
|
mnode_t[] out;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dnode_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dnode_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / qfiles.dnode_t.SIZE;
|
count = l.filelen / qfiles.dnode_t.SIZE;
|
||||||
// out = Hunk_Alloc ( count*sizeof(*out));
|
// out = Hunk_Alloc ( count*sizeof(*out));
|
||||||
@@ -797,7 +798,7 @@ public abstract class Model extends Surf {
|
|||||||
int i, j, count;
|
int i, j, count;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dleaf_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dleaf_t.SIZE) != 0)
|
||||||
Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error (ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / qfiles.dleaf_t.SIZE;
|
count = l.filelen / qfiles.dleaf_t.SIZE;
|
||||||
// out = Hunk_Alloc ( count*sizeof(*out));
|
// out = Hunk_Alloc ( count*sizeof(*out));
|
||||||
@@ -842,7 +843,7 @@ public abstract class Model extends Surf {
|
|||||||
msurface_t[] out;
|
msurface_t[] out;
|
||||||
|
|
||||||
if ((l.filelen % Defines.SIZE_OF_SHORT) != 0)
|
if ((l.filelen % Defines.SIZE_OF_SHORT) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
count = l.filelen / Defines.SIZE_OF_SHORT;
|
count = l.filelen / Defines.SIZE_OF_SHORT;
|
||||||
// out = Hunk_Alloc ( count*sizeof(*out));
|
// out = Hunk_Alloc ( count*sizeof(*out));
|
||||||
out = new msurface_t[count];
|
out = new msurface_t[count];
|
||||||
@@ -857,7 +858,7 @@ public abstract class Model extends Surf {
|
|||||||
{
|
{
|
||||||
j = bb.getShort();
|
j = bb.getShort();
|
||||||
if (j < 0 || j >= loadmodel.numsurfaces)
|
if (j < 0 || j >= loadmodel.numsurfaces)
|
||||||
Com.Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number");
|
Com.Error(ErrorCode.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number");
|
||||||
|
|
||||||
out[i] = loadmodel.surfaces[j];
|
out[i] = loadmodel.surfaces[j];
|
||||||
}
|
}
|
||||||
@@ -875,11 +876,11 @@ public abstract class Model extends Surf {
|
|||||||
int[] offsets;
|
int[] offsets;
|
||||||
|
|
||||||
if ( (l.filelen % Defines.SIZE_OF_INT) != 0)
|
if ( (l.filelen % Defines.SIZE_OF_INT) != 0)
|
||||||
Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error (ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / Defines.SIZE_OF_INT;
|
count = l.filelen / Defines.SIZE_OF_INT;
|
||||||
if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES)
|
if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES)
|
||||||
Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count);
|
Com.Error (ErrorCode.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count);
|
||||||
|
|
||||||
offsets = new int[count];
|
offsets = new int[count];
|
||||||
|
|
||||||
@@ -907,7 +908,7 @@ public abstract class Model extends Surf {
|
|||||||
int bits;
|
int bits;
|
||||||
|
|
||||||
if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
|
if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
|
||||||
Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
Com.Error(ErrorCode.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name);
|
||||||
|
|
||||||
count = l.filelen / qfiles.dplane_t.SIZE;
|
count = l.filelen / qfiles.dplane_t.SIZE;
|
||||||
// out = Hunk_Alloc ( count*2*sizeof(*out));
|
// out = Hunk_Alloc ( count*2*sizeof(*out));
|
||||||
@@ -952,13 +953,13 @@ public abstract class Model extends Surf {
|
|||||||
|
|
||||||
loadmodel.type = mod_brush;
|
loadmodel.type = mod_brush;
|
||||||
if (loadmodel != mod_known[0])
|
if (loadmodel != mod_known[0])
|
||||||
Com.Error(Defines.ERR_DROP, "Loaded a brush model after the world");
|
Com.Error(ErrorCode.ERR_DROP, "Loaded a brush model after the world");
|
||||||
|
|
||||||
header = new qfiles.dheader_t(buffer);
|
header = new qfiles.dheader_t(buffer);
|
||||||
|
|
||||||
i = header.version;
|
i = header.version;
|
||||||
if (i != Defines.BSPVERSION)
|
if (i != Defines.BSPVERSION)
|
||||||
Com.Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")");
|
Com.Error (ErrorCode.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")");
|
||||||
|
|
||||||
mod_base = fileBuffer; //(byte *)header;
|
mod_base = fileBuffer; //(byte *)header;
|
||||||
|
|
||||||
@@ -992,7 +993,7 @@ public abstract class Model extends Surf {
|
|||||||
starmod.nummodelsurfaces = bm.numfaces;
|
starmod.nummodelsurfaces = bm.numfaces;
|
||||||
starmod.firstnode = bm.headnode;
|
starmod.firstnode = bm.headnode;
|
||||||
if (starmod.firstnode >= loadmodel.numnodes)
|
if (starmod.firstnode >= loadmodel.numnodes)
|
||||||
Com.Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode");
|
Com.Error(ErrorCode.ERR_DROP, "Inline model " + i + " has bad firstnode");
|
||||||
|
|
||||||
Math3D.VectorCopy(bm.maxs, starmod.maxs);
|
Math3D.VectorCopy(bm.maxs, starmod.maxs);
|
||||||
Math3D.VectorCopy(bm.mins, starmod.mins);
|
Math3D.VectorCopy(bm.mins, starmod.mins);
|
||||||
@@ -1030,26 +1031,26 @@ public abstract class Model extends Surf {
|
|||||||
pheader = new qfiles.dmdl_t(buffer);
|
pheader = new qfiles.dmdl_t(buffer);
|
||||||
|
|
||||||
if (pheader.version != qfiles.ALIAS_VERSION)
|
if (pheader.version != qfiles.ALIAS_VERSION)
|
||||||
Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)",
|
Com.Error(ErrorCode.ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||||
new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION));
|
new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION));
|
||||||
|
|
||||||
if (pheader.skinheight > MAX_LBM_HEIGHT)
|
if (pheader.skinheight > MAX_LBM_HEIGHT)
|
||||||
Com.Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT);
|
Com.Error(ErrorCode.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT);
|
||||||
|
|
||||||
if (pheader.num_xyz <= 0)
|
if (pheader.num_xyz <= 0)
|
||||||
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices");
|
Com.Error(ErrorCode.ERR_DROP, "model " + mod.name + " has no vertices");
|
||||||
|
|
||||||
if (pheader.num_xyz > qfiles.MAX_VERTS)
|
if (pheader.num_xyz > qfiles.MAX_VERTS)
|
||||||
Com.Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices");
|
Com.Error(ErrorCode.ERR_DROP, "model " + mod.name +" has too many vertices");
|
||||||
|
|
||||||
if (pheader.num_st <= 0)
|
if (pheader.num_st <= 0)
|
||||||
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices");
|
Com.Error(ErrorCode.ERR_DROP, "model " + mod.name + " has no st vertices");
|
||||||
|
|
||||||
if (pheader.num_tris <= 0)
|
if (pheader.num_tris <= 0)
|
||||||
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles");
|
Com.Error(ErrorCode.ERR_DROP, "model " + mod.name + " has no triangles");
|
||||||
|
|
||||||
if (pheader.num_frames <= 0)
|
if (pheader.num_frames <= 0)
|
||||||
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no frames");
|
Com.Error(ErrorCode.ERR_DROP, "model " + mod.name + " has no frames");
|
||||||
|
|
||||||
//
|
//
|
||||||
// load base s and t vertices (not used in gl version)
|
// load base s and t vertices (not used in gl version)
|
||||||
@@ -1148,11 +1149,11 @@ public abstract class Model extends Surf {
|
|||||||
qfiles.dsprite_t sprout = new qfiles.dsprite_t(buffer);
|
qfiles.dsprite_t sprout = new qfiles.dsprite_t(buffer);
|
||||||
|
|
||||||
if (sprout.version != qfiles.SPRITE_VERSION)
|
if (sprout.version != qfiles.SPRITE_VERSION)
|
||||||
Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)",
|
Com.Error(ErrorCode.ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||||
new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION));
|
new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION));
|
||||||
|
|
||||||
if (sprout.numframes > qfiles.MAX_MD2SKINS)
|
if (sprout.numframes > qfiles.MAX_MD2SKINS)
|
||||||
Com.Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)",
|
Com.Error(ErrorCode.ERR_DROP, "%s has too many frames (%i > %i)",
|
||||||
new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS));
|
new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS));
|
||||||
|
|
||||||
for (int i=0 ; i<sprout.numframes ; i++)
|
for (int i=0 ; i<sprout.numframes ; i++)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.client.dlight_t;
|
import lwjake2.client.dlight_t;
|
||||||
import lwjake2.client.entity_t;
|
import lwjake2.client.entity_t;
|
||||||
import lwjake2.client.lightstyle_t;
|
import lwjake2.client.lightstyle_t;
|
||||||
@@ -1035,7 +1036,7 @@ public abstract class Surf extends Draw {
|
|||||||
GL11.GL_UNSIGNED_BYTE,
|
GL11.GL_UNSIGNED_BYTE,
|
||||||
gl_lms.lightmap_buffer );
|
gl_lms.lightmap_buffer );
|
||||||
if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
||||||
Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
|
Com.Error( ErrorCode.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
|
||||||
|
|
||||||
//debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4);
|
//debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4);
|
||||||
}
|
}
|
||||||
@@ -1170,7 +1171,7 @@ public abstract class Surf extends Draw {
|
|||||||
lightPos = new pos_t(surf.light_s, surf.light_t);
|
lightPos = new pos_t(surf.light_s, surf.light_t);
|
||||||
if ( !LM_AllocBlock( smax, tmax, lightPos ) )
|
if ( !LM_AllocBlock( smax, tmax, lightPos ) )
|
||||||
{
|
{
|
||||||
Com.Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n");
|
Com.Error( ErrorCode.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.render.lwjgl;
|
package lwjake2.render.lwjgl;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
import lwjake2.render.glpoly_t;
|
import lwjake2.render.glpoly_t;
|
||||||
@@ -121,7 +122,7 @@ public abstract class Warp extends Model {
|
|||||||
float frac;
|
float frac;
|
||||||
|
|
||||||
if (numverts > 60)
|
if (numverts > 60)
|
||||||
Com.Error(Defines.ERR_DROP, "numverts = " + numverts);
|
Com.Error(ErrorCode.ERR_DROP, "numverts = " + numverts);
|
||||||
|
|
||||||
float[] mins = Vec3Cache.get();
|
float[] mins = Vec3Cache.get();
|
||||||
float[] maxs = Vec3Cache.get();
|
float[] maxs = Vec3Cache.get();
|
||||||
@@ -447,7 +448,7 @@ public abstract class Warp extends Model {
|
|||||||
void ClipSkyPolygon(int nump, float[][] vecs, int stage)
|
void ClipSkyPolygon(int nump, float[][] vecs, int stage)
|
||||||
{
|
{
|
||||||
if (nump > MAX_CLIP_VERTS-2)
|
if (nump > MAX_CLIP_VERTS-2)
|
||||||
Com.Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS");
|
Com.Error(ErrorCode.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS");
|
||||||
if (stage == 6)
|
if (stage == 6)
|
||||||
{ // fully clipped, so draw it
|
{ // fully clipped, so draw it
|
||||||
DrawSkyPolygon(nump, vecs);
|
DrawSkyPolygon(nump, vecs);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.client.M;
|
import lwjake2.client.M;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
@@ -83,7 +84,7 @@ public final class SV {
|
|||||||
ent.nextthink = 0;
|
ent.nextthink = 0;
|
||||||
|
|
||||||
if (ent.think == null)
|
if (ent.think == null)
|
||||||
Com.Error(Defines.ERR_FATAL, "NULL ent.think");
|
Com.Error(ErrorCode.ERR_FATAL, "NULL ent.think");
|
||||||
|
|
||||||
ent.think.think(ent);
|
ent.think.think(ent);
|
||||||
|
|
||||||
@@ -487,7 +488,7 @@ public final class SV {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GameBase.pushed_p > Defines.MAX_EDICTS)
|
if (GameBase.pushed_p > Defines.MAX_EDICTS)
|
||||||
SV_GAME.PF_error(Defines.ERR_FATAL,
|
SV_GAME.PF_error(ErrorCode.ERR_FATAL,
|
||||||
"pushed_p > &pushed[MAX_EDICTS], memory corrupted");
|
"pushed_p > &pushed[MAX_EDICTS], memory corrupted");
|
||||||
|
|
||||||
if (part != null) {
|
if (part != null) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.game.EndianHandler;
|
import lwjake2.game.EndianHandler;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
import lwjake2.game.edict_t;
|
import lwjake2.game.edict_t;
|
||||||
@@ -369,7 +370,7 @@ public class SV_ENTS {
|
|||||||
count = CM.CM_BoxLeafnums(mins, maxs, leafs, 64, null);
|
count = CM.CM_BoxLeafnums(mins, maxs, leafs, 64, null);
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
Com.Error(Defines.ERR_FATAL, "SV_FatPVS: count < 1");
|
Com.Error(ErrorCode.ERR_FATAL, "SV_FatPVS: count < 1");
|
||||||
|
|
||||||
longs = (CM.CM_NumClusters() + 31) >> 5;
|
longs = (CM.CM_NumClusters() + 31) >> 5;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
import lwjake2.game.GameSave;
|
import lwjake2.game.GameSave;
|
||||||
@@ -90,7 +91,7 @@ public class SV_GAME {
|
|||||||
if (ent != null) {
|
if (ent != null) {
|
||||||
n = ent.index;
|
n = ent.index;
|
||||||
if (n < 1 || n > SV_MAIN.maxclients.value)
|
if (n < 1 || n > SV_MAIN.maxclients.value)
|
||||||
Com.Error(Defines.ERR_DROP, "cprintf to a non-client");
|
Com.Error(ErrorCode.ERR_DROP, "cprintf to a non-client");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent != null)
|
if (ent != null)
|
||||||
@@ -122,7 +123,7 @@ public class SV_GAME {
|
|||||||
* Abort the server with a game error.
|
* Abort the server with a game error.
|
||||||
*/
|
*/
|
||||||
public static void PF_error(String fmt) {
|
public static void PF_error(String fmt) {
|
||||||
Com.Error(Defines.ERR_DROP, "Game Error: " + fmt);
|
Com.Error(ErrorCode.ERR_DROP, "Game Error: " + fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PF_error(int level, String fmt) {
|
public static void PF_error(int level, String fmt) {
|
||||||
@@ -139,7 +140,7 @@ public class SV_GAME {
|
|||||||
cmodel_t mod;
|
cmodel_t mod;
|
||||||
|
|
||||||
if (name == null)
|
if (name == null)
|
||||||
Com.Error(Defines.ERR_DROP, "PF_setmodel: NULL");
|
Com.Error(ErrorCode.ERR_DROP, "PF_setmodel: NULL");
|
||||||
|
|
||||||
i = SV_INIT.SV_ModelIndex(name);
|
i = SV_INIT.SV_ModelIndex(name);
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ public class SV_GAME {
|
|||||||
*/
|
*/
|
||||||
public static void PF_Configstring(int index, String val) {
|
public static void PF_Configstring(int index, String val) {
|
||||||
if (index < 0 || index >= Defines.MAX_CONFIGSTRINGS)
|
if (index < 0 || index >= Defines.MAX_CONFIGSTRINGS)
|
||||||
Com.Error(Defines.ERR_DROP, "configstring: bad index " + index
|
Com.Error(ErrorCode.ERR_DROP, "configstring: bad index " + index
|
||||||
+ "\n");
|
+ "\n");
|
||||||
|
|
||||||
if (val == null)
|
if (val == null)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.server;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.client.CL;
|
import lwjake2.client.CL;
|
||||||
import lwjake2.client.SCR;
|
import lwjake2.client.SCR;
|
||||||
@@ -65,7 +66,7 @@ public class SV_INIT {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (i == max)
|
if (i == max)
|
||||||
Com.Error(Defines.ERR_DROP, "*Index: overflow");
|
Com.Error(ErrorCode.ERR_DROP, "*Index: overflow");
|
||||||
|
|
||||||
sv.configstrings[start + i] = name;
|
sv.configstrings[start + i] = name;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.EndianHandler;
|
import lwjake2.game.EndianHandler;
|
||||||
import lwjake2.game.edict_t;
|
import lwjake2.game.edict_t;
|
||||||
@@ -184,7 +185,7 @@ public class SV_SEND {
|
|||||||
|
|
||||||
default :
|
default :
|
||||||
mask = null;
|
mask = null;
|
||||||
Com.Error(Defines.ERR_FATAL, "SV_Multicast: bad to:" + to + "\n");
|
Com.Error(ErrorCode.ERR_FATAL, "SV_Multicast: bad to:" + to + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the data to all relevent clients
|
// send the data to all relevent clients
|
||||||
@@ -261,16 +262,16 @@ public class SV_SEND {
|
|||||||
boolean use_phs;
|
boolean use_phs;
|
||||||
|
|
||||||
if (volume < 0 || volume > 1.0)
|
if (volume < 0 || volume > 1.0)
|
||||||
Com.Error(Defines.ERR_FATAL, "SV_StartSound: volume = " + volume);
|
Com.Error(ErrorCode.ERR_FATAL, "SV_StartSound: volume = " + volume);
|
||||||
|
|
||||||
if (attenuation < 0 || attenuation > 4)
|
if (attenuation < 0 || attenuation > 4)
|
||||||
Com.Error(Defines.ERR_FATAL, "SV_StartSound: attenuation = " + attenuation);
|
Com.Error(ErrorCode.ERR_FATAL, "SV_StartSound: attenuation = " + attenuation);
|
||||||
|
|
||||||
// if (channel < 0 || channel > 15)
|
// if (channel < 0 || channel > 15)
|
||||||
// Com_Error (ERR_FATAL, "SV_StartSound: channel = %i", channel);
|
// Com_Error (ERR_FATAL, "SV_StartSound: channel = %i", channel);
|
||||||
|
|
||||||
if (timeofs < 0 || timeofs > 0.255)
|
if (timeofs < 0 || timeofs > 0.255)
|
||||||
Com.Error(Defines.ERR_FATAL, "SV_StartSound: timeofs = " + timeofs);
|
Com.Error(ErrorCode.ERR_FATAL, "SV_StartSound: timeofs = " + timeofs);
|
||||||
|
|
||||||
ent = entity.index;
|
ent = entity.index;
|
||||||
|
|
||||||
@@ -481,7 +482,7 @@ public class SV_SEND {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msglen > Defines.MAX_MSGLEN)
|
if (msglen > Defines.MAX_MSGLEN)
|
||||||
Com.Error(Defines.ERR_DROP, "SV_SendClientMessages: msglen > MAX_MSGLEN");
|
Com.Error(ErrorCode.ERR_DROP, "SV_SendClientMessages: msglen > MAX_MSGLEN");
|
||||||
|
|
||||||
//r = fread (msgbuf, msglen, 1, sv.demofile);
|
//r = fread (msgbuf, msglen, 1, sv.demofile);
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
@@ -86,10 +87,10 @@ public class SV_USER {
|
|||||||
try {
|
try {
|
||||||
SV_INIT.sv.demofile = fileSystem.FOpenFile(name);
|
SV_INIT.sv.demofile = fileSystem.FOpenFile(name);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Com.Error(Defines.ERR_DROP, "Couldn't open " + name + "\n");
|
Com.Error(ErrorCode.ERR_DROP, "Couldn't open " + name + "\n");
|
||||||
}
|
}
|
||||||
if (SV_INIT.sv.demofile == null)
|
if (SV_INIT.sv.demofile == null)
|
||||||
Com.Error(Defines.ERR_DROP, "Couldn't open " + name + "\n");
|
Com.Error(ErrorCode.ERR_DROP, "Couldn't open " + name + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.server;
|
package lwjake2.server;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
import lwjake2.game.cmodel_t;
|
import lwjake2.game.cmodel_t;
|
||||||
@@ -401,7 +402,7 @@ public class SV_WORLD {
|
|||||||
// explicit hulls in the BSP model
|
// explicit hulls in the BSP model
|
||||||
model = SV_INIT.sv.models[ent.s.modelindex];
|
model = SV_INIT.sv.models[ent.s.modelindex];
|
||||||
if (null == model)
|
if (null == model)
|
||||||
Com.Error(Defines.ERR_FATAL,
|
Com.Error(ErrorCode.ERR_FATAL,
|
||||||
"MOVETYPE_PUSH with a non bsp model");
|
"MOVETYPE_PUSH with a non bsp model");
|
||||||
return model.headnode;
|
return model.headnode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.sound;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.qcommon.BaseQ2FileSystem;
|
import lwjake2.qcommon.BaseQ2FileSystem;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
import lwjake2.qcommon.FileSystem;
|
import lwjake2.qcommon.FileSystem;
|
||||||
@@ -328,7 +329,7 @@ public class WaveLoader {
|
|||||||
|
|
||||||
if (info.samples != 0) {
|
if (info.samples != 0) {
|
||||||
if (samples < info.samples)
|
if (samples < info.samples)
|
||||||
Com.Error(Defines.ERR_DROP, "Sound " + name + " has a bad loop length");
|
Com.Error(ErrorCode.ERR_DROP, "Sound " + name + " has a bad loop length");
|
||||||
} else {
|
} else {
|
||||||
info.samples = samples;
|
info.samples = samples;
|
||||||
if (info.loopstart > 0) info.samples -= info.loopstart;
|
if (info.loopstart > 0) info.samples -= info.loopstart;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.sound.lwjgl;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.Cmd;
|
import lwjake2.game.Cmd;
|
||||||
import lwjake2.game.GameBase;
|
import lwjake2.game.GameBase;
|
||||||
@@ -390,12 +391,12 @@ public final class LWJGLSoundImpl implements Sound {
|
|||||||
sfx_t sfx = null;
|
sfx_t sfx = null;
|
||||||
|
|
||||||
if (name == null)
|
if (name == null)
|
||||||
Com.Error(Defines.ERR_FATAL, "S_FindName: NULL\n");
|
Com.Error(ErrorCode.ERR_FATAL, "S_FindName: NULL\n");
|
||||||
if (name.length() == 0)
|
if (name.length() == 0)
|
||||||
Com.Error(Defines.ERR_FATAL, "S_FindName: empty name\n");
|
Com.Error(ErrorCode.ERR_FATAL, "S_FindName: empty name\n");
|
||||||
|
|
||||||
if (name.length() >= Defines.MAX_QPATH)
|
if (name.length() >= Defines.MAX_QPATH)
|
||||||
Com.Error(Defines.ERR_FATAL, "Sound name too long: " + name);
|
Com.Error(ErrorCode.ERR_FATAL, "Sound name too long: " + name);
|
||||||
|
|
||||||
// see if already loaded
|
// see if already loaded
|
||||||
for (i = 0; i < num_sfx; i++)
|
for (i = 0; i < num_sfx; i++)
|
||||||
@@ -414,7 +415,7 @@ public final class LWJGLSoundImpl implements Sound {
|
|||||||
|
|
||||||
if (i == num_sfx) {
|
if (i == num_sfx) {
|
||||||
if (num_sfx == MAX_SFX)
|
if (num_sfx == MAX_SFX)
|
||||||
Com.Error(Defines.ERR_FATAL, "S_FindName: out of sfx_t");
|
Com.Error(ErrorCode.ERR_FATAL, "S_FindName: out of sfx_t");
|
||||||
num_sfx++;
|
num_sfx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +450,7 @@ public final class LWJGLSoundImpl implements Sound {
|
|||||||
if (i == num_sfx)
|
if (i == num_sfx)
|
||||||
{
|
{
|
||||||
if (num_sfx == MAX_SFX)
|
if (num_sfx == MAX_SFX)
|
||||||
Com.Error(Defines.ERR_FATAL, "S_FindName: out of sfx_t");
|
Com.Error(ErrorCode.ERR_FATAL, "S_FindName: out of sfx_t");
|
||||||
num_sfx++;
|
num_sfx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package lwjake2.sys;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.Globals;
|
import lwjake2.Globals;
|
||||||
import lwjake2.game.cvar_t;
|
import lwjake2.game.cvar_t;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
@@ -258,7 +259,7 @@ public final class NET {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (to.type != Defines.NA_BROADCAST && to.type != Defines.NA_IP) {
|
if (to.type != Defines.NA_BROADCAST && to.type != Defines.NA_IP) {
|
||||||
Com.Error(Defines.ERR_FATAL, "NET_SendPacket: bad address type");
|
Com.Error(ErrorCode.ERR_FATAL, "NET_SendPacket: bad address type");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package lwjake2.util;
|
package lwjake2.util;
|
||||||
|
|
||||||
import lwjake2.Defines;
|
import lwjake2.Defines;
|
||||||
|
import lwjake2.ErrorCode;
|
||||||
import lwjake2.game.cplane_t;
|
import lwjake2.game.cplane_t;
|
||||||
import lwjake2.qcommon.Com;
|
import lwjake2.qcommon.Com;
|
||||||
|
|
||||||
@@ -478,7 +479,7 @@ public class Math3D {
|
|||||||
double x;
|
double x;
|
||||||
|
|
||||||
if (fov_x < 1.0f || fov_x > 179.0f)
|
if (fov_x < 1.0f || fov_x > 179.0f)
|
||||||
Com.Error(Defines.ERR_DROP, "Bad fov: " + fov_x);
|
Com.Error(ErrorCode.ERR_DROP, "Bad fov: " + fov_x);
|
||||||
|
|
||||||
x = width / Math.tan(fov_x * piratio);
|
x = width / Math.tan(fov_x * piratio);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user