Skip to content

Commit

Permalink
Merge remote-tracking branch 'remaster/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Sep 29, 2024
2 parents 3370c6f + fa1132e commit 6126e4e
Show file tree
Hide file tree
Showing 9 changed files with 2,384 additions and 358 deletions.
81 changes: 75 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,45 +336,83 @@ set(Game-Source
${COMMON_SRC_DIR}/shared/flash.c
${COMMON_SRC_DIR}/shared/rand.c
${COMMON_SRC_DIR}/shared/shared.c
${GAME_SRC_DIR}/dm/ball.c
${GAME_SRC_DIR}/dm/tag.c
${GAME_SRC_DIR}/g_ai.c
${GAME_SRC_DIR}/g_chase.c
${GAME_SRC_DIR}/g_cmds.c
${GAME_SRC_DIR}/g_combat.c
${GAME_SRC_DIR}/g_ctf.c
${GAME_SRC_DIR}/g_func.c
${GAME_SRC_DIR}/g_items.c
${GAME_SRC_DIR}/g_main.c
${GAME_SRC_DIR}/g_misc.c
${GAME_SRC_DIR}/g_monster.c
${GAME_SRC_DIR}/g_newai.c
${GAME_SRC_DIR}/g_newdm.c
${GAME_SRC_DIR}/g_newfnc.c
${GAME_SRC_DIR}/g_newtarg.c
${GAME_SRC_DIR}/g_newtrig.c
${GAME_SRC_DIR}/g_newweap.c
${GAME_SRC_DIR}/g_phys.c
${GAME_SRC_DIR}/g_spawn.c
${GAME_SRC_DIR}/g_sphere.c
${GAME_SRC_DIR}/g_svcmds.c
${GAME_SRC_DIR}/g_target.c
${GAME_SRC_DIR}/g_translate.c
${GAME_SRC_DIR}/g_trigger.c
${GAME_SRC_DIR}/g_turret.c
${GAME_SRC_DIR}/g_utils.c
${GAME_SRC_DIR}/g_weapon.c
${GAME_SRC_DIR}/menu/menu.c
${GAME_SRC_DIR}/monster/actor/actor.c
${GAME_SRC_DIR}/monster/arachnid/arachnid.c
${GAME_SRC_DIR}/monster/army/army.c
${GAME_SRC_DIR}/monster/berserker/berserker.c
${GAME_SRC_DIR}/monster/boss2/boss2.c
${GAME_SRC_DIR}/monster/boss3/boss3.c
${GAME_SRC_DIR}/monster/boss3/boss31.c
${GAME_SRC_DIR}/monster/boss3/boss32.c
${GAME_SRC_DIR}/monster/boss3/boss3.c
${GAME_SRC_DIR}/monster/boss5/boss5.c
${GAME_SRC_DIR}/monster/brain/brain.c
${GAME_SRC_DIR}/monster/carrier/carrier.c
${GAME_SRC_DIR}/monster/chick/chick.c
${GAME_SRC_DIR}/monster/demon/demon.c
${GAME_SRC_DIR}/monster/dog/dog.c
${GAME_SRC_DIR}/monster/enforcer/enforcer.c
${GAME_SRC_DIR}/monster/fish/fish.c
${GAME_SRC_DIR}/monster/fixbot/fixbot.c
${GAME_SRC_DIR}/monster/flipper/flipper.c
${GAME_SRC_DIR}/monster/float/float.c
${GAME_SRC_DIR}/monster/flyer/flyer.c
${GAME_SRC_DIR}/monster/gekk/gekk.c
${GAME_SRC_DIR}/monster/gladiator/gladb.c
${GAME_SRC_DIR}/monster/gladiator/gladiator.c
${GAME_SRC_DIR}/monster/guardian/guardian.c
${GAME_SRC_DIR}/monster/gunner/gunner.c
${GAME_SRC_DIR}/monster/hknight/hknight.c
${GAME_SRC_DIR}/monster/hover/hover.c
${GAME_SRC_DIR}/monster/infantry/infantry.c
${GAME_SRC_DIR}/monster/insane/insane.c
${GAME_SRC_DIR}/monster/knight/knight.c
${GAME_SRC_DIR}/monster/medic/medic.c
${GAME_SRC_DIR}/monster/misc/move.c
${GAME_SRC_DIR}/monster/mutant/mutant.c
${GAME_SRC_DIR}/monster/ogre/ogre.c
${GAME_SRC_DIR}/monster/parasite/parasite.c
${GAME_SRC_DIR}/monster/shalrath/shalrath.c
${GAME_SRC_DIR}/monster/shambler/shambler.c
${GAME_SRC_DIR}/monster/soldier/soldier.c
${GAME_SRC_DIR}/monster/stalker/stalker.c
${GAME_SRC_DIR}/monster/supertank/supertank.c
${GAME_SRC_DIR}/monster/tank/tank.c
${GAME_SRC_DIR}/monster/tarbaby/tarbaby.c
${GAME_SRC_DIR}/monster/turret/turret.c
${GAME_SRC_DIR}/monster/widow/widow2.c
${GAME_SRC_DIR}/monster/widow/widow.c
${GAME_SRC_DIR}/monster/wizard/wizard.c
${GAME_SRC_DIR}/monster/zombie/zombie.c
${GAME_SRC_DIR}/player/chase.c
${GAME_SRC_DIR}/player/client.c
${GAME_SRC_DIR}/player/hud.c
${GAME_SRC_DIR}/player/trail.c
Expand Down Expand Up @@ -452,18 +490,23 @@ set(Client-Source
${COMMON_SRC_DIR}/collision.c
${COMMON_SRC_DIR}/crc.c
${COMMON_SRC_DIR}/cmdparser.c
${COMMON_SRC_DIR}/cmodels.c
${COMMON_SRC_DIR}/cvar.c
${COMMON_SRC_DIR}/filesystem.c
${COMMON_SRC_DIR}/glob.c
${COMMON_SRC_DIR}/maps.c
${COMMON_SRC_DIR}/md4.c
${COMMON_SRC_DIR}/movemsg.c
${COMMON_SRC_DIR}/models.c
${COMMON_SRC_DIR}/frame.c
${COMMON_SRC_DIR}/netchan.c
${COMMON_SRC_DIR}/pmove.c
${COMMON_SRC_DIR}/protocol.c
${COMMON_SRC_DIR}/szone.c
${COMMON_SRC_DIR}/zone.c
${COMMON_SRC_DIR}/shared/flash.c
${COMMON_SRC_DIR}/shared/rand.c
${COMMON_SRC_DIR}/shared/utils.c
${COMMON_SRC_DIR}/shared/shared.c
${COMMON_SRC_DIR}/unzip/ioapi.c
${COMMON_SRC_DIR}/unzip/unzip.c
Expand Down Expand Up @@ -532,14 +575,17 @@ set(Server-Source
${COMMON_SRC_DIR}/collision.c
${COMMON_SRC_DIR}/crc.c
${COMMON_SRC_DIR}/cmdparser.c
${COMMON_SRC_DIR}/cmodels.c
${COMMON_SRC_DIR}/cvar.c
${COMMON_SRC_DIR}/filesystem.c
${COMMON_SRC_DIR}/glob.c
${COMMON_SRC_DIR}/maps.c
${COMMON_SRC_DIR}/md4.c
${COMMON_SRC_DIR}/frame.c
${COMMON_SRC_DIR}/movemsg.c
${COMMON_SRC_DIR}/netchan.c
${COMMON_SRC_DIR}/pmove.c
${COMMON_SRC_DIR}/protocol.c
${COMMON_SRC_DIR}/szone.c
${COMMON_SRC_DIR}/zone.c
${COMMON_SRC_DIR}/shared/rand.c
Expand Down Expand Up @@ -592,13 +638,20 @@ set(GL1-Source
${REF_SRC_DIR}/gl1/gl1_warp.c
${REF_SRC_DIR}/gl1/gl1_sdl.c
${REF_SRC_DIR}/gl1/gl1_buffer.c
${REF_SRC_DIR}/files/light.c
${REF_SRC_DIR}/files/maps.c
${REF_SRC_DIR}/files/mesh.c
${REF_SRC_DIR}/files/models.c
${REF_SRC_DIR}/files/pcx.c
${REF_SRC_DIR}/files/models_md5.c
${REF_SRC_DIR}/files/models_mdr.c
${REF_SRC_DIR}/files/stb.c
${REF_SRC_DIR}/files/surf.c
${REF_SRC_DIR}/files/wal.c
${REF_SRC_DIR}/files/warp.c
${REF_SRC_DIR}/files/pvs.c
${COMMON_SRC_DIR}/shared/utils.c
${COMMON_SRC_DIR}/shared/shared.c
${COMMON_SRC_DIR}/cmodels.c
${COMMON_SRC_DIR}/md4.c
)

Expand Down Expand Up @@ -635,13 +688,21 @@ set(GL3-Source
${REF_SRC_DIR}/gl3/gl3_surf.c
${REF_SRC_DIR}/gl3/gl3_warp.c
${REF_SRC_DIR}/gl3/gl3_shaders.c
${REF_SRC_DIR}/files/glshaders.c
${REF_SRC_DIR}/files/light.c
${REF_SRC_DIR}/files/maps.c
${REF_SRC_DIR}/files/mesh.c
${REF_SRC_DIR}/files/models.c
${REF_SRC_DIR}/files/pcx.c
${REF_SRC_DIR}/files/models_md5.c
${REF_SRC_DIR}/files/models_mdr.c
${REF_SRC_DIR}/files/stb.c
${REF_SRC_DIR}/files/surf.c
${REF_SRC_DIR}/files/wal.c
${REF_SRC_DIR}/files/warp.c
${REF_SRC_DIR}/files/pvs.c
${COMMON_SRC_DIR}/shared/utils.c
${COMMON_SRC_DIR}/shared/shared.c
${COMMON_SRC_DIR}/cmodels.c
${COMMON_SRC_DIR}/md4.c
)

Expand All @@ -654,8 +715,8 @@ set(GL3-Header
${REF_SRC_DIR}/constants/anormtab.h
${REF_SRC_DIR}/constants/warpsin.h
${REF_SRC_DIR}/files/stb_image.h
${REF_SRC_DIR}/gl3/header/DG_dynarr.h
${REF_SRC_DIR}/gl3/header/HandmadeMath.h
${REF_SRC_DIR}/files/DG_dynarr.h
${REF_SRC_DIR}/files/HandmadeMath.h
${REF_SRC_DIR}/gl3/header/local.h
${REF_SRC_DIR}/gl3/header/model.h
${COMMON_SRC_DIR}/header/shared.h
Expand Down Expand Up @@ -689,13 +750,21 @@ set(SOFT-Source
${REF_SRC_DIR}/soft/sw_scan.c
${REF_SRC_DIR}/soft/sw_sprite.c
${REF_SRC_DIR}/soft/sw_surf.c
${REF_SRC_DIR}/soft/sw_warp.c
${REF_SRC_DIR}/files/light.c
${REF_SRC_DIR}/files/maps.c
${REF_SRC_DIR}/files/mesh.c
${REF_SRC_DIR}/files/models.c
${REF_SRC_DIR}/files/pcx.c
${REF_SRC_DIR}/files/models_md5.c
${REF_SRC_DIR}/files/models_mdr.c
${REF_SRC_DIR}/files/stb.c
${REF_SRC_DIR}/files/surf.c
${REF_SRC_DIR}/files/wal.c
${REF_SRC_DIR}/files/warp.c
${REF_SRC_DIR}/files/pvs.c
${COMMON_SRC_DIR}/shared/utils.c
${COMMON_SRC_DIR}/shared/shared.c
${COMMON_SRC_DIR}/cmodels.c
${COMMON_SRC_DIR}/md4.c
)

Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,12 @@ build/ref_vk/%.o: %.c

# The baseq2 game
ifeq ($(YQ2_OSTYPE), Windows)
game:
game: stuff/models/entity.dat
@echo "===> Building baseq2/game.dll"
${Q}mkdir -p release/baseq2
$(MAKE) release/baseq2/game.dll
${Q}mkdir -p release/baseq2/models
${Q}cp stuff/models/entity.dat release/baseq2/models

build/baseq2/%.o: %.c
@echo "===> CC $<"
Expand All @@ -911,10 +913,12 @@ release/baseq2/game.dll : LDFLAGS += -shared

else ifeq ($(YQ2_OSTYPE), Darwin)

game:
game: stuff/models/entity.dat
@echo "===> Building baseq2/game.dylib"
${Q}mkdir -p release/baseq2
$(MAKE) release/baseq2/game.dylib
${Q}mkdir -p release/baseq2/models
${Q}cp stuff/models/entity.dat release/baseq2/models

build/baseq2/%.o: %.c
@echo "===> CC $<"
Expand All @@ -931,10 +935,12 @@ release/baseq2/game.dylib : LDFLAGS += -shared

else # not Windows or Darwin

game:
game: stuff/models/entity.dat
@echo "===> Building baseq2/game.so"
${Q}mkdir -p release/baseq2
$(MAKE) release/baseq2/game.so
${Q}mkdir -p release/baseq2/models
${Q}cp stuff/models/entity.dat release/baseq2/models

build/baseq2/%.o: %.c
@echo "===> CC $<"
Expand Down
45 changes: 33 additions & 12 deletions src/game/g_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,29 @@ typedef struct
int no_mip;
char spawn_sequence[MAX_QPATH];
char description[MAX_QPATH];
/* Additional fields */
vec3_t color;
} dynamicentity_t;

static dynamicentity_t *dynamicentities;
static int ndynamicentities;

static void
DynamicSpawn(edict_t *self, dynamicentity_t *data)
DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
{
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_BBOX;
/* update properties by dynamic properties */
self->s.modelindex = gi.modelindex(data->model_path);

VectorCopy(data->mins, self->mins);
VectorCopy(data->maxs, self->maxs);
}

static void
DynamicSpawn(edict_t *self)
{
/* All other properties could be updated in DynamicSpawnUpdate */
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_BBOX;

gi.linkentity(self);
}
Expand Down Expand Up @@ -120,7 +129,7 @@ ED_CallSpawn(edict_t *ent)
{
spawn_t *s;
gitem_t *item;
int i;
int i, dyn_id;

if (!ent)
{
Expand All @@ -141,6 +150,18 @@ ED_CallSpawn(edict_t *ent)
return;
}

/* search dynamic definitions */
dyn_id = -1;
if (dynamicentities && ndynamicentities)
{
dyn_id = DynamicSpawnSearch(ent->classname);

if (dyn_id >= 0)
{
DynamicSpawnUpdate(ent, &dynamicentities[dyn_id]);
}
}

/* check normal spawn functions */
for (s = spawns; s->name; s++)
{
Expand All @@ -165,15 +186,12 @@ ED_CallSpawn(edict_t *ent)
}
}

if (dynamicentities && ndynamicentities)
if (dyn_id >= 0 && dynamicentities[dyn_id].model_path[0])
{
i = DynamicSpawnSearch(ent->classname);
if (i >= 0)
{
DynamicSpawn(ent, &dynamicentities[i]);
/* spawn only if know model */
DynamicSpawn(ent);

return;
}
return;
}

/* SiN entity could have model path as model field */
Expand All @@ -190,7 +208,8 @@ ED_CallSpawn(edict_t *ent)

if (gi.FS_LoadFile(self.model_path, NULL) > 4)
{
DynamicSpawn(ent, &self);
DynamicSpawnUpdate(ent, &self);
DynamicSpawn(ent);
return;
}
}
Expand Down Expand Up @@ -1218,6 +1237,8 @@ DynamicSpawnInit(void)
line = DynamicIntParse(line, &dynamicentities[curr_pos].no_mip);
line = DynamicStringParse(line, dynamicentities[curr_pos].spawn_sequence, MAX_QPATH, '|');
line = DynamicStringParse(line, dynamicentities[curr_pos].description, MAX_QPATH, '|');
/* Additional field for cover for color from QUAKED */
line = DynamicFloatParse(line, dynamicentities[curr_pos].color, 3, '|');

curr_pos ++;
}
Expand Down
Loading

0 comments on commit 6126e4e

Please sign in to comment.