0

enum ModelType

This commit is contained in:
2019-06-04 13:40:02 +03:00
parent 716c70ce9f
commit 976d405d8f
5 changed files with 25 additions and 26 deletions

View File

@@ -0,0 +1,8 @@
package dmx.lwjake2.render;
public enum ModelType {
BAD,
BRUSH,
SPRITE,
ALIAS
}

View File

@@ -47,15 +47,6 @@ public abstract class Base extends LWJGLBase {
* model skin sprite frame wall texture pic * model skin sprite frame wall texture pic
*/ */
// enum modtype_t
static final int mod_bad = 0;
static final int mod_brush = 1;
static final int mod_sprite = 2;
static final int mod_alias = 3;
static final int TEXNUM_LIGHTMAPS = 1024; static final int TEXNUM_LIGHTMAPS = 1024;
static final int TEXNUM_SCRAPS = 1152; static final int TEXNUM_SCRAPS = 1152;

View File

@@ -408,13 +408,13 @@ public abstract class Main extends Base {
continue; continue;
} }
switch (currentmodel.type) { switch (currentmodel.type) {
case mod_alias : case ALIAS:
R_DrawAliasModel(currententity); R_DrawAliasModel(currententity);
break; break;
case mod_brush : case BRUSH:
R_DrawBrushModel(currententity); R_DrawBrushModel(currententity);
break; break;
case mod_sprite : case SPRITE:
R_DrawSpriteModel(currententity); R_DrawSpriteModel(currententity);
break; break;
default : default :
@@ -442,13 +442,13 @@ public abstract class Main extends Base {
continue; continue;
} }
switch (currentmodel.type) { switch (currentmodel.type) {
case mod_alias : case ALIAS:
R_DrawAliasModel(currententity); R_DrawAliasModel(currententity);
break; break;
case mod_brush : case BRUSH:
R_DrawBrushModel(currententity); R_DrawBrushModel(currententity);
break; break;
case mod_sprite : case SPRITE:
R_DrawSpriteModel(currententity); R_DrawSpriteModel(currententity);
break; break;
default : default :

View File

@@ -19,6 +19,7 @@
package lwjake2.render.lwjgl; package lwjake2.render.lwjgl;
import dmx.lwjake2.render.ImageType; import dmx.lwjake2.render.ImageType;
import dmx.lwjake2.render.ModelType;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.ErrorCode; import lwjake2.ErrorCode;
import lwjake2.client.VID; import lwjake2.client.VID;
@@ -953,7 +954,7 @@ public abstract class Model extends Surf {
qfiles.dheader_t header; qfiles.dheader_t header;
mmodel_t bm; mmodel_t bm;
loadmodel.type = mod_brush; loadmodel.type = ModelType.BRUSH;
if (loadmodel != mod_known[0]) if (loadmodel != mod_known[0])
Com.Error(ErrorCode.ERR_DROP, "Loaded a brush model after the world"); Com.Error(ErrorCode.ERR_DROP, "Loaded a brush model after the world");
@@ -1089,7 +1090,7 @@ public abstract class Model extends Surf {
} }
} }
mod.type = mod_alias; mod.type = ModelType.ALIAS;
// //
// load the glcmds // load the glcmds
@@ -1163,7 +1164,7 @@ public abstract class Model extends Surf {
mod.skins[i] = GL_FindImage(sprout.frames[i].name, SPRITE); mod.skins[i] = GL_FindImage(sprout.frames[i].name, SPRITE);
} }
mod.type = mod_sprite; mod.type = ModelType.SPRITE;
mod.extradata = sprout; mod.extradata = sprout;
} }
@@ -1218,13 +1219,13 @@ public abstract class Model extends Surf {
mod.registration_sequence = registration_sequence; mod.registration_sequence = registration_sequence;
// register any images used by the models // register any images used by the models
if (mod.type == mod_sprite) if (mod.type == ModelType.SPRITE)
{ {
sprout = (qfiles.dsprite_t)mod.extradata; sprout = (qfiles.dsprite_t)mod.extradata;
for (i=0 ; i<sprout.numframes ; i++) for (i=0 ; i<sprout.numframes ; i++)
mod.skins[i] = GL_FindImage(sprout.frames[i].name, SPRITE); mod.skins[i] = GL_FindImage(sprout.frames[i].name, SPRITE);
} }
else if (mod.type == mod_alias) else if (mod.type == ModelType.ALIAS)
{ {
pheader = (qfiles.dmdl_t)mod.extradata; pheader = (qfiles.dmdl_t)mod.extradata;
for (i=0 ; i<pheader.num_skins ; i++) for (i=0 ; i<pheader.num_skins ; i++)
@@ -1233,7 +1234,7 @@ public abstract class Model extends Surf {
mod.numframes = pheader.num_frames; mod.numframes = pheader.num_frames;
// PGM // PGM
} }
else if (mod.type == mod_brush) else if (mod.type == ModelType.BRUSH)
{ {
for (i=0 ; i<mod.numtexinfo ; i++) for (i=0 ; i<mod.numtexinfo ; i++)
mod.texinfo[i].image.registration_sequence = registration_sequence; mod.texinfo[i].image.registration_sequence = registration_sequence;
@@ -1263,7 +1264,7 @@ public abstract class Model extends Surf {
Mod_Free(mod); Mod_Free(mod);
} else { } else {
// precompile AliasModels // precompile AliasModels
if (mod.type == mod_alias) if (mod.type == ModelType.ALIAS)
precompileGLCmds((qfiles.dmdl_t)mod.extradata); precompileGLCmds((qfiles.dmdl_t)mod.extradata);
} }
} }

View File

@@ -18,6 +18,7 @@
package lwjake2.render; package lwjake2.render;
import dmx.lwjake2.render.ModelType;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.game.cplane_t; import lwjake2.game.cplane_t;
import lwjake2.qcommon.qfiles; import lwjake2.qcommon.qfiles;
@@ -32,8 +33,7 @@ public class model_t implements Cloneable {
public int registration_sequence; public int registration_sequence;
// was enum modtype_t public ModelType type;
public int type;
public int numframes; public int numframes;
public int flags; public int flags;
@@ -104,8 +104,7 @@ public class model_t implements Cloneable {
name = ""; name = "";
registration_sequence = 0; registration_sequence = 0;
// was enum modtype_t type = ModelType.BAD;
type = 0;
numframes = 0; numframes = 0;
flags = 0; flags = 0;