mirror of
https://github.com/yquake2/slightmechanicaldestruction.git
synced 2024-11-21 20:20:58 +00:00
Add Alan "Alkaline" Cofers port of SMD to YQ2.
This is a best efford port of SMD to YQ2 done by Alan "Alkaline" Cofers. While this is not a perfect port it's good enough to compile with modern gcc and clang versions. It's possible to play through the whole mod without (too many) bugs. All credits and honor for this go to Alkaline!
This commit is contained in:
parent
832a9ef8e1
commit
5dabb4237a
28 changed files with 10608 additions and 79 deletions
111
Changelog.txt
Normal file
111
Changelog.txt
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
Credits:
|
||||||
|
Thanks goes to (alphabetically) David Hyde, Knightmare, Musashi, and Yamagi for their respective work on keeping Q2 both alive and also playable on modern architectures.
|
||||||
|
|
||||||
|
|
||||||
|
Known Bugs:
|
||||||
|
- The game will crash if a door tries to close on any monster either living or dead. Be sure to gib any monsters that die in a doorway.
|
||||||
|
- After the cutscene, gun and crosshair visibility are not automatically restored. To restore the Q2 defaults, you can set "cl_gun 2" and "crosshair 1" in the console.
|
||||||
|
|
||||||
|
|
||||||
|
Release 2 Notes:
|
||||||
|
- Saving now works on all maps! The "target_effect" entity has been disabled because it was causing the game to crash when loading save files in maps that use it. SPOILER: In SMD3 the hallway with the Brains near the start of the map consequently has an invisible trap now. Be sure to locate the switch to disable the "invisible steam" before passing down the hallway.
|
||||||
|
|
||||||
|
Release 2 Change Log:
|
||||||
|
g_func_decs.h
|
||||||
|
Missing function declaration added
|
||||||
|
|
||||||
|
g_target.c
|
||||||
|
Disabled the SP_target_effect entity and all related functions
|
||||||
|
|
||||||
|
|
||||||
|
Release 1 Notes:
|
||||||
|
- No attempt has been made to clean up the original Lazarus_SMD code beyond simply getting it compiling with GCC and as operational in-game as I could.
|
||||||
|
- Music and footstep noises are unavailable on non-Windows platforms due to FMOD being Windows-only.
|
||||||
|
- Fog is disabled on all platforms. Re-enabling it on Windows would require removing all code related to the 3dfxgl implementation of GLide (which neither GCC or YamagiQ2 supports).
|
||||||
|
- On Windows the old Lazarus save-file system is used w/o Knightmare's enhancements. This is because the list of game functions is slightly different when compiled on Windows, owing to the differences in Sound listed above.
|
||||||
|
|
||||||
|
Release 1 Change Log:
|
||||||
|
g_cmds.c
|
||||||
|
Change _MAX_PATH to MAX_OSPATH
|
||||||
|
Added Q_strlwr() definition to replace non-standard strlwr() reference
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
Added Knightmare's SetLazarusCrosshair() definition
|
||||||
|
|
||||||
|
g_crane.c
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
|
||||||
|
g_fog.c
|
||||||
|
Uncomment "#define DISABLE_FOG"
|
||||||
|
|
||||||
|
g_func_decs.h & g_func_list.h
|
||||||
|
Files added to support Knightmare's changes to g_save.c
|
||||||
|
|
||||||
|
g_items.c
|
||||||
|
*_armor_index variable declarations now match g_local.h
|
||||||
|
Per Knightmare: Removed "static" modifier from declarations for drop_temp_touch() and drop_make_touchable()
|
||||||
|
|
||||||
|
g_local.h
|
||||||
|
Added max/min macros
|
||||||
|
Added "#define DISABLE_FMOD" if not compiled on Windows
|
||||||
|
|
||||||
|
g_misc.c
|
||||||
|
Don't patch models; comment out Windows-specific direct.h
|
||||||
|
Make sure self->activator->classname isn't NULL before using it in func_clock_screen_think()
|
||||||
|
Per Knightmare: Removed "static" modifier from declarations for func_clock_reset(), func_clock_format_countdown(), and light_use()
|
||||||
|
|
||||||
|
g_mmove_decs.h & g_mmove_list.h
|
||||||
|
Files added to support Knightmare's changes to g_save.c
|
||||||
|
|
||||||
|
g_monster.c
|
||||||
|
Comment out Windows-specific direct.h
|
||||||
|
|
||||||
|
g_patchplayermodels.c
|
||||||
|
Don't patch models; comment out Windows-specific direct.h
|
||||||
|
|
||||||
|
g_target.c
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
|
||||||
|
g_trigger.c
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
Added Yamagi's code for locating the YamagiQ2 save directory to trans_ent_filename()
|
||||||
|
|
||||||
|
g_save.c
|
||||||
|
Replaced original g_save.c file with Knightmare's version
|
||||||
|
Moved Knightmare's "#define"s related to saving from q_shared.h to g_save.c
|
||||||
|
Add "#ifndef DISABLE_FMOD" block around call to FMOD's ReadTextureSurfaceAssignments()
|
||||||
|
Re-order text displayed when InitGame() is called to match YamagiQ2's expected formatting
|
||||||
|
|
||||||
|
g_sound.c
|
||||||
|
Added Knightmare's "#ifdef DISABLE_FMOD" code-block
|
||||||
|
|
||||||
|
g_spawn.c
|
||||||
|
Change _MAX_PATH to MAX_OSPATH
|
||||||
|
Add "#ifndef DISABLE_FMOD" block around use of FMOD footsteps boolean
|
||||||
|
|
||||||
|
g_trigger.c
|
||||||
|
Change _MAX_PATH to MAX_OSPATH
|
||||||
|
|
||||||
|
g_weapon.c
|
||||||
|
Per Knightmare: Removed "static" modifier from declarations for check_dodge(), check_dodge_inf_mg(), fire_lead(), Grenade_Add_To_Chain(), Grenade_Remove_From_Chain(), Grenade_Explode(), Grenade_Touch(), rocket_explode(), and rocket_die()
|
||||||
|
|
||||||
|
p_client.c
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
Per Knightmare: Removed "static" modifier from declarations for SP_FixCoopSpots() and SP_CreateCoopSpots()
|
||||||
|
|
||||||
|
m_actor.c
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
|
||||||
|
p_client.c
|
||||||
|
Added Knightmare's calls to SetLazarusCrosshair()
|
||||||
|
|
||||||
|
p_text.c
|
||||||
|
Explicitly cast temp_buffer variable as char before math operations
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
Use "/" instead of "\\" when delineating folder names
|
||||||
|
|
||||||
|
p_view.c
|
||||||
|
Add "#ifndef DISABLE_FMOD" block around use of FMOD footsteps boolean
|
||||||
|
Change stricmp() references to Q_stricmp()
|
||||||
|
|
||||||
|
q_shared.c
|
||||||
|
Added "#define GCC_COMP" to disable operations unsupported by GCC
|
244
Makefile
Normal file
244
Makefile
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
# ----------------------------------------------------- #
|
||||||
|
# Makefile for the "Slight Mechanical Destruction #
|
||||||
|
# by Musashi" (SMD) game module for Quake II #
|
||||||
|
# Ported from the original SMD source code for Windows #
|
||||||
|
# by Alkaline - See included Changelog for details #
|
||||||
|
# #
|
||||||
|
# Just type "make" to compile the #
|
||||||
|
# SMD Game library (game.so / game.dylib / game.dll) #
|
||||||
|
# #
|
||||||
|
# Build Dependencies: #
|
||||||
|
# - None, but you need Quake II (and SMD) to play. #
|
||||||
|
# While in theory any engine should work, #
|
||||||
|
# Yamagi Quake II is recommended. #
|
||||||
|
# #
|
||||||
|
# Compatible Platforms: #
|
||||||
|
# - Linux (compiles, plays, and saves) #
|
||||||
|
# - macOS (compiles, plays, and saves) #
|
||||||
|
# - Windows (compiles w/MinGW; not play-tested) #
|
||||||
|
# - Other? (Should compile on most Unix-like OSes) #
|
||||||
|
# ----------------------------------------------------- #
|
||||||
|
|
||||||
|
# Detect the OS
|
||||||
|
ifdef SystemRoot
|
||||||
|
OSTYPE := Windows
|
||||||
|
else
|
||||||
|
OSTYPE := $(shell uname -s)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Special case for MinGW
|
||||||
|
ifneq (,$(findstring MINGW,$(OSTYPE)))
|
||||||
|
OSTYPE := Windows
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Detect the architecture
|
||||||
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
# At this time only i386 is supported on Windows
|
||||||
|
ARCH := i386
|
||||||
|
# seems like mingw doesn't set CC by default
|
||||||
|
CC := gcc
|
||||||
|
else
|
||||||
|
# Some platforms call it "amd64" and some "x86_64"
|
||||||
|
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Refuse all other platforms as a firewall against PEBKAC
|
||||||
|
# (You'll need some #ifdef for your unsupported platform!)
|
||||||
|
ifeq ($(findstring $(ARCH), i386 x86_64 sparc64 ia64),)
|
||||||
|
$(error arch $(ARCH) is currently not supported)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Base CFLAGS.
|
||||||
|
#
|
||||||
|
# -O2 are enough optimizations.
|
||||||
|
#
|
||||||
|
# -fno-strict-aliasing since the source doesn't comply
|
||||||
|
# with strict aliasing rules and it's next to impossible
|
||||||
|
# to get it there...
|
||||||
|
#
|
||||||
|
# -fomit-frame-pointer since the framepointer is mostly
|
||||||
|
# useless for debugging Quake II and slows things down.
|
||||||
|
#
|
||||||
|
# -g to build allways with debug symbols. Please do not
|
||||||
|
# change this, since it's our only chance to debug this
|
||||||
|
# crap when random crashes happen!
|
||||||
|
#
|
||||||
|
# -fPIC for position independend code.
|
||||||
|
#
|
||||||
|
# -MMD to generate header dependencies.
|
||||||
|
ifeq ($(OSTYPE), Darwin)
|
||||||
|
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
|
||||||
|
-Wall -pipe -g -fwrapv -arch i386 -arch x86_64
|
||||||
|
else
|
||||||
|
CFLAGS := -O0 -fno-strict-aliasing -fomit-frame-pointer \
|
||||||
|
-Wall -pipe -ggdb -MMD -fwrapv
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Base LDFLAGS.
|
||||||
|
ifeq ($(OSTYPE), Darwin)
|
||||||
|
LDFLAGS := -shared -arch i386 -arch x86_64
|
||||||
|
else
|
||||||
|
LDFLAGS := -shared
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Builds everything
|
||||||
|
all: smd
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# When make is invoked by "make VERBOSE=1" print
|
||||||
|
# the compiler and linker commands.
|
||||||
|
|
||||||
|
ifdef VERBOSE
|
||||||
|
Q :=
|
||||||
|
else
|
||||||
|
Q := @
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Phony targets
|
||||||
|
.PHONY : all clean smd
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
clean:
|
||||||
|
@echo "===> CLEAN"
|
||||||
|
${Q}rm -Rf build release
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# The SMD game
|
||||||
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
FILESUFFIX := dll
|
||||||
|
smd:
|
||||||
|
@echo "===> Building game.dll"
|
||||||
|
${Q}mkdir -p release
|
||||||
|
$(MAKE) release/game.dll
|
||||||
|
|
||||||
|
build/%.o: %.c
|
||||||
|
@echo "===> CC $<"
|
||||||
|
${Q}mkdir -p $(@D)
|
||||||
|
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
else
|
||||||
|
ifeq ($(OSTYPE), Darwin)
|
||||||
|
FILESUFFIX := dylib
|
||||||
|
else
|
||||||
|
FILESUFFIX := so
|
||||||
|
endif
|
||||||
|
|
||||||
|
smd:
|
||||||
|
@echo "===> Building game.${FILESUFFIX}"
|
||||||
|
${Q}mkdir -p release
|
||||||
|
$(MAKE) release/game.${FILESUFFIX}
|
||||||
|
|
||||||
|
build/%.o: %.c
|
||||||
|
@echo "===> CC $<"
|
||||||
|
${Q}mkdir -p $(@D)
|
||||||
|
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
release/game.${FILESUFFIX} : CFLAGS += -fPIC
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
SMD_OBJS_ = \
|
||||||
|
src/g_ai.o \
|
||||||
|
src/g_camera.o \
|
||||||
|
src/g_chase.o \
|
||||||
|
src/g_cmds.o \
|
||||||
|
src/g_combat.o \
|
||||||
|
src/g_crane.o \
|
||||||
|
src/g_fog.o \
|
||||||
|
src/g_func.o \
|
||||||
|
src/g_items.o \
|
||||||
|
src/g_jetpack.o \
|
||||||
|
src/g_lights.o \
|
||||||
|
src/g_lock.o \
|
||||||
|
src/g_main.o \
|
||||||
|
src/g_misc.o \
|
||||||
|
src/g_model.o \
|
||||||
|
src/g_monster.o \
|
||||||
|
src/g_mtrain.o \
|
||||||
|
src/g_newai.o \
|
||||||
|
src/g_patchplayermodels.o \
|
||||||
|
src/g_pendulum.o \
|
||||||
|
src/g_phys.o \
|
||||||
|
src/g_reflect.o \
|
||||||
|
src/g_save.o \
|
||||||
|
src/g_sound.o \
|
||||||
|
src/g_spawn.o \
|
||||||
|
src/g_svcmds.o \
|
||||||
|
src/g_target.o \
|
||||||
|
src/g_thing.o \
|
||||||
|
src/g_tracktrain.o \
|
||||||
|
src/g_trigger.o \
|
||||||
|
src/g_turret.o \
|
||||||
|
src/g_utils.o \
|
||||||
|
src/g_vehicle.o \
|
||||||
|
src/g_weapon.o \
|
||||||
|
src/m_actor_weap.o \
|
||||||
|
src/m_actor.o \
|
||||||
|
src/m_berserk.o \
|
||||||
|
src/m_boss2.o \
|
||||||
|
src/m_boss3.o \
|
||||||
|
src/m_boss31.o \
|
||||||
|
src/m_boss32.o \
|
||||||
|
src/m_brain.o \
|
||||||
|
src/m_chick.o \
|
||||||
|
src/m_flash.o \
|
||||||
|
src/m_flipper.o \
|
||||||
|
src/m_float.o \
|
||||||
|
src/m_flyer.o \
|
||||||
|
src/m_gladiator.o \
|
||||||
|
src/m_gunner.o \
|
||||||
|
src/m_hover.o \
|
||||||
|
src/m_infantry.o \
|
||||||
|
src/m_insane.o \
|
||||||
|
src/m_medic.o \
|
||||||
|
src/m_move.o \
|
||||||
|
src/m_mutant.o \
|
||||||
|
src/m_parasite.o \
|
||||||
|
src/m_sentrybot.o \
|
||||||
|
src/m_soldier.o \
|
||||||
|
src/m_supertank.o \
|
||||||
|
src/m_tank.o \
|
||||||
|
src/p_client.o \
|
||||||
|
src/p_chase.o \
|
||||||
|
src/p_hud.o \
|
||||||
|
src/p_menu.o \
|
||||||
|
src/p_text.o \
|
||||||
|
src/p_trail.o \
|
||||||
|
src/p_view.o \
|
||||||
|
src/p_weapon.o \
|
||||||
|
src/q_shared.o
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Rewrite paths to our object directory
|
||||||
|
SMD_OBJS = $(patsubst %,build/%,$(SMD_OBJS_))
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Generate header dependencies
|
||||||
|
SMD_DEPS= $(SMD_OBJS:.o=.d)
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Suck header dependencies in
|
||||||
|
-include $(SMD_DEPS)
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
release/game.${FILESUFFIX} : $(SMD_OBJS)
|
||||||
|
@echo "===> LD $@"
|
||||||
|
${Q}$(CC) $(LDFLAGS) -o $@ $(SMD_OBJS)
|
||||||
|
|
||||||
|
# ----------
|
33
src/g_cmds.c
33
src/g_cmds.c
|
@ -3,6 +3,17 @@
|
||||||
|
|
||||||
int nostatus = 0;
|
int nostatus = 0;
|
||||||
|
|
||||||
|
char *Q_strlwr(char *str)
|
||||||
|
{
|
||||||
|
unsigned char *p = (unsigned char *)str;
|
||||||
|
|
||||||
|
while (*p) {
|
||||||
|
*p = tolower((unsigned char)*p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
void RotateAngles(vec3_t in, vec3_t delta, vec3_t out)
|
void RotateAngles(vec3_t in, vec3_t delta, vec3_t out)
|
||||||
{
|
{
|
||||||
|
@ -875,7 +886,7 @@ void Cmd_Use_f (edict_t *ent)
|
||||||
}
|
}
|
||||||
index = ITEM_INDEX(it);
|
index = ITEM_INDEX(it);
|
||||||
#ifdef JETPACK_MOD
|
#ifdef JETPACK_MOD
|
||||||
if(!stricmp(s,"jetpack"))
|
if(!Q_stricmp(s,"jetpack"))
|
||||||
{
|
{
|
||||||
// Special case - turns on/off
|
// Special case - turns on/off
|
||||||
if(!ent->client->jetpack)
|
if(!ent->client->jetpack)
|
||||||
|
@ -897,7 +908,7 @@ void Cmd_Use_f (edict_t *ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!stricmp(s,"stasis generator"))
|
if (!Q_stricmp(s,"stasis generator"))
|
||||||
{
|
{
|
||||||
// Special case - turn freeze off if already on
|
// Special case - turn freeze off if already on
|
||||||
if(level.freeze)
|
if(level.freeze)
|
||||||
|
@ -1032,7 +1043,7 @@ void Cmd_InvUse_f (edict_t *ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JETPACK_MOD
|
#ifdef JETPACK_MOD
|
||||||
if(!stricmp(it->classname,"item_jetpack"))
|
if(!Q_stricmp(it->classname,"item_jetpack"))
|
||||||
{
|
{
|
||||||
if(!ent->client->jetpack)
|
if(!ent->client->jetpack)
|
||||||
{
|
{
|
||||||
|
@ -1535,6 +1546,18 @@ void Cmd_Bbox_f (edict_t *ent)
|
||||||
DrawBBox(viewing);
|
DrawBBox(viewing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetLazarusCrosshair (edict_t *ent)
|
||||||
|
{
|
||||||
|
if (deathmatch->value || coop->value) return;
|
||||||
|
if (!ent->inuse) return;
|
||||||
|
if (!ent->client) return;
|
||||||
|
if (ent->client->zoomed || ent->client->zooming)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gi.cvar_forceset("lazarus_crosshair", va("%d",(int)(crosshair->value)));
|
||||||
|
gi.cvar_forceset("lazarus_cl_gun", va("%d",(int)(cl_gun->value)));
|
||||||
|
}
|
||||||
|
|
||||||
void SetSensitivities(edict_t *ent,qboolean reset)
|
void SetSensitivities(edict_t *ent,qboolean reset)
|
||||||
{
|
{
|
||||||
char string[512];
|
char string[512];
|
||||||
|
@ -2081,7 +2104,7 @@ void ClientCommand (edict_t *ent)
|
||||||
{
|
{
|
||||||
edict_t *temp;
|
edict_t *temp;
|
||||||
|
|
||||||
strlwr(parm);
|
Q_strlwr(parm);
|
||||||
temp = G_Spawn();
|
temp = G_Spawn();
|
||||||
temp->message = parm;
|
temp->message = parm;
|
||||||
temp->volume = 255;
|
temp->volume = 255;
|
||||||
|
@ -2101,7 +2124,7 @@ void ClientCommand (edict_t *ent)
|
||||||
else if(!Q_stricmp(cmd, "properties"))
|
else if(!Q_stricmp(cmd, "properties"))
|
||||||
{
|
{
|
||||||
if(parm) {
|
if(parm) {
|
||||||
char filename[_MAX_PATH];
|
char filename[MAX_OSPATH];
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
// int i;
|
// int i;
|
||||||
|
|
|
@ -217,7 +217,7 @@ void Crane_Move_Done (edict_t *ent)
|
||||||
}
|
}
|
||||||
// Lazarus: ACK! If crate is being carried, it's NOT a MOVETYPE_PUSHABLE!!!!
|
// Lazarus: ACK! If crate is being carried, it's NOT a MOVETYPE_PUSHABLE!!!!
|
||||||
// if(ent->movetype == MOVETYPE_PUSHABLE)
|
// if(ent->movetype == MOVETYPE_PUSHABLE)
|
||||||
if(!stricmp(ent->classname,"func_pushable"))
|
if(!Q_stricmp(ent->classname,"func_pushable"))
|
||||||
{
|
{
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ void Crane_Move_Final (edict_t *ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale (ent->moveinfo.dir, ent->moveinfo.remaining_distance / FRAMETIME, ent->velocity);
|
VectorScale (ent->moveinfo.dir, ent->moveinfo.remaining_distance / FRAMETIME, ent->velocity);
|
||||||
if(!stricmp(ent->classname,"crane_hook"))
|
if(!Q_stricmp(ent->classname,"crane_hook"))
|
||||||
{
|
{
|
||||||
VectorCopy(ent->velocity,ent->crane_cable->velocity);
|
VectorCopy(ent->velocity,ent->crane_cable->velocity);
|
||||||
ent->crane_cable->velocity[2] = 0;
|
ent->crane_cable->velocity[2] = 0;
|
||||||
|
@ -450,7 +450,7 @@ void Crane_Move_Begin (edict_t *ent)
|
||||||
VectorScale (ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity);
|
VectorScale (ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity);
|
||||||
frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) / FRAMETIME);
|
frames = floor((ent->moveinfo.remaining_distance / ent->moveinfo.speed) / FRAMETIME);
|
||||||
ent->moveinfo.remaining_distance -= frames * ent->moveinfo.speed * FRAMETIME;
|
ent->moveinfo.remaining_distance -= frames * ent->moveinfo.speed * FRAMETIME;
|
||||||
if(!stricmp(ent->classname,"crane_hook"))
|
if(!Q_stricmp(ent->classname,"crane_hook"))
|
||||||
{
|
{
|
||||||
if((ent->crane_light) && (ent->crane_cargo==NULL))
|
if((ent->crane_light) && (ent->crane_cargo==NULL))
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ void G_FindCraneParts()
|
||||||
continue;
|
continue;
|
||||||
if (!e->classname)
|
if (!e->classname)
|
||||||
continue;
|
continue;
|
||||||
if (stricmp(e->classname,"crane_control"))
|
if (Q_stricmp(e->classname,"crane_control"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
control = e;
|
control = e;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
//#define DISABLE_FOG
|
#define DISABLE_FOG
|
||||||
|
|
||||||
#ifdef DISABLE_FOG
|
#ifdef DISABLE_FOG
|
||||||
void Fog_Init()
|
void Fog_Init()
|
||||||
|
|
1620
src/g_func_decs.h
Normal file
1620
src/g_func_decs.h
Normal file
File diff suppressed because it is too large
Load diff
1621
src/g_func_list.h
Normal file
1621
src/g_func_list.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -24,9 +24,9 @@ gitem_armor_t combatarmor_info = { 50, 100, .60, .30, ARMOR_COMBAT};
|
||||||
gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
|
gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
|
||||||
|
|
||||||
int noweapon_index;
|
int noweapon_index;
|
||||||
static int jacket_armor_index;
|
int jacket_armor_index;
|
||||||
static int combat_armor_index;
|
int combat_armor_index;
|
||||||
static int body_armor_index;
|
int body_armor_index;
|
||||||
static int power_screen_index;
|
static int power_screen_index;
|
||||||
static int power_shield_index;
|
static int power_shield_index;
|
||||||
int shells_index;
|
int shells_index;
|
||||||
|
@ -935,7 +935,7 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
|
/*static*/ void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
|
||||||
{
|
{
|
||||||
if (other == ent->owner)
|
if (other == ent->owner)
|
||||||
return;
|
return;
|
||||||
|
@ -943,7 +943,7 @@ static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csur
|
||||||
Touch_Item (ent, other, plane, surf);
|
Touch_Item (ent, other, plane, surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drop_make_touchable (edict_t *ent)
|
/*static*/ void drop_make_touchable (edict_t *ent)
|
||||||
{
|
{
|
||||||
ent->touch = Touch_Item;
|
ent->touch = Touch_Item;
|
||||||
if (deathmatch->value)
|
if (deathmatch->value)
|
||||||
|
|
|
@ -17,6 +17,13 @@
|
||||||
|
|
||||||
#define PI 3.14159265359
|
#define PI 3.14159265359
|
||||||
|
|
||||||
|
#define max(X,Y) (X > Y ? X : Y)
|
||||||
|
#define min(X,Y) (X < Y ? X : Y)
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#define DISABLE_FMOD
|
||||||
|
#endif
|
||||||
|
|
||||||
// protocol bytes that can be directly added to messages
|
// protocol bytes that can be directly added to messages
|
||||||
#define svc_muzzleflash 1
|
#define svc_muzzleflash 1
|
||||||
#define svc_muzzleflash2 2
|
#define svc_muzzleflash2 2
|
||||||
|
|
12
src/g_misc.c
12
src/g_misc.c
|
@ -766,7 +766,7 @@ Default _cone value is 10 (used to set size of light for spotlights)
|
||||||
|
|
||||||
#define START_OFF 1
|
#define START_OFF 1
|
||||||
|
|
||||||
static void light_use (edict_t *self, edict_t *other, edict_t *activator)
|
/*static*/ void light_use (edict_t *self, edict_t *other, edict_t *activator)
|
||||||
{
|
{
|
||||||
if (self->spawnflags & START_OFF)
|
if (self->spawnflags & START_OFF)
|
||||||
{
|
{
|
||||||
|
@ -2265,7 +2265,7 @@ If START_OFF, this entity must be used before it starts
|
||||||
// don't let field width of any clock messages change, or it
|
// don't let field width of any clock messages change, or it
|
||||||
// could cause an overwrite after a game load
|
// could cause an overwrite after a game load
|
||||||
|
|
||||||
static void func_clock_reset (edict_t *self)
|
/*static*/ void func_clock_reset (edict_t *self)
|
||||||
{
|
{
|
||||||
self->activator = NULL;
|
self->activator = NULL;
|
||||||
if (self->spawnflags & 1)
|
if (self->spawnflags & 1)
|
||||||
|
@ -2280,7 +2280,7 @@ static void func_clock_reset (edict_t *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void func_clock_format_countdown (edict_t *self)
|
/*static*/ void func_clock_format_countdown (edict_t *self)
|
||||||
{
|
{
|
||||||
if (self->style == 0)
|
if (self->style == 0)
|
||||||
{
|
{
|
||||||
|
@ -2445,7 +2445,7 @@ void func_clock_screen_think(edict_t *self)
|
||||||
self->nextthink = level.time + 1;
|
self->nextthink = level.time + 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (Q_stricmp(self->activator->classname, "player")) //map not yet finished loading
|
else if (!self->activator->classname || Q_stricmp(self->activator->classname, "player")) //map not yet finished loading
|
||||||
{
|
{
|
||||||
self->nextthink = level.time + 1;
|
self->nextthink = level.time + 1;
|
||||||
return;
|
return;
|
||||||
|
@ -3754,11 +3754,13 @@ MISC_DEADSOLDIER MODEL PATCH
|
||||||
#define MAX_SKINNAME 64
|
#define MAX_SKINNAME 64
|
||||||
#define DEADSOLDIER_MODEL "models/deadbods/dude/tris.md2"
|
#define DEADSOLDIER_MODEL "models/deadbods/dude/tris.md2"
|
||||||
|
|
||||||
#include <direct.h>
|
//#include <direct.h>
|
||||||
#include "pak.h"
|
#include "pak.h"
|
||||||
|
|
||||||
int PatchDeadSoldier ()
|
int PatchDeadSoldier ()
|
||||||
{
|
{
|
||||||
|
return 1;
|
||||||
|
|
||||||
cvar_t *gamedir;
|
cvar_t *gamedir;
|
||||||
char skins[NUM_SKINS][MAX_SKINNAME]; // skin entries
|
char skins[NUM_SKINS][MAX_SKINNAME]; // skin entries
|
||||||
char infilename[MAX_OSPATH];
|
char infilename[MAX_OSPATH];
|
||||||
|
|
319
src/g_mmove_decs.h
Normal file
319
src/g_mmove_decs.h
Normal file
|
@ -0,0 +1,319 @@
|
||||||
|
extern mmove_t tank_move_death ;
|
||||||
|
extern mmove_t tank_move_attack_chain ;
|
||||||
|
extern mmove_t tank_move_attack_post_rocket ;
|
||||||
|
extern mmove_t tank_move_attack_fire_rocket ;
|
||||||
|
extern mmove_t tank_move_attack_pre_rocket ;
|
||||||
|
extern mmove_t tank_move_attack_strike ;
|
||||||
|
extern mmove_t tank_move_attack_post_blast ;
|
||||||
|
extern mmove_t tank_move_reattack_blast ;
|
||||||
|
extern mmove_t tank_move_attack_blast ;
|
||||||
|
extern mmove_t tank_move_pain3 ;
|
||||||
|
extern mmove_t tank_move_pain2 ;
|
||||||
|
extern mmove_t tank_move_pain1 ;
|
||||||
|
extern mmove_t tank_move_stop_run ;
|
||||||
|
extern mmove_t tank_move_run ;
|
||||||
|
extern mmove_t tank_move_start_run ;
|
||||||
|
extern mmove_t tank_move_stop_walk ;
|
||||||
|
extern mmove_t tank_move_walk ;
|
||||||
|
extern mmove_t tank_move_start_walk ;
|
||||||
|
extern mmove_t tank_move_stand ;
|
||||||
|
extern mmove_t supertank_move_end_attack1 ;
|
||||||
|
extern mmove_t supertank_move_attack1 ;
|
||||||
|
extern mmove_t supertank_move_attack2 ;
|
||||||
|
extern mmove_t supertank_move_attack3 ;
|
||||||
|
extern mmove_t supertank_move_attack4 ;
|
||||||
|
extern mmove_t supertank_move_backward ;
|
||||||
|
extern mmove_t supertank_move_death ;
|
||||||
|
extern mmove_t supertank_move_pain1 ;
|
||||||
|
extern mmove_t supertank_move_pain2 ;
|
||||||
|
extern mmove_t supertank_move_pain3 ;
|
||||||
|
extern mmove_t supertank_move_turn_left ;
|
||||||
|
extern mmove_t supertank_move_turn_right ;
|
||||||
|
extern mmove_t supertank_move_forward ;
|
||||||
|
extern mmove_t supertank_move_run ;
|
||||||
|
extern mmove_t supertank_move_stand ;
|
||||||
|
extern mmove_t soldier_move_jump ;
|
||||||
|
extern mmove_t soldier_move_death6 ;
|
||||||
|
extern mmove_t soldier_move_death5 ;
|
||||||
|
extern mmove_t soldier_move_death4 ;
|
||||||
|
extern mmove_t soldier_move_death3 ;
|
||||||
|
extern mmove_t soldier_move_death2 ;
|
||||||
|
extern mmove_t soldier_move_death1 ;
|
||||||
|
extern mmove_t soldier_move_duck ;
|
||||||
|
extern mmove_t soldier_move_attack6 ;
|
||||||
|
extern mmove_t soldier_move_attack4 ;
|
||||||
|
extern mmove_t soldier_move_attack3 ;
|
||||||
|
extern mmove_t soldier_move_attack2 ;
|
||||||
|
extern mmove_t soldier_move_attack1 ;
|
||||||
|
extern mmove_t soldier_move_pain4 ;
|
||||||
|
extern mmove_t soldier_move_pain3 ;
|
||||||
|
extern mmove_t soldier_move_pain2 ;
|
||||||
|
extern mmove_t soldier_move_pain1 ;
|
||||||
|
extern mmove_t soldier_move_run ;
|
||||||
|
extern mmove_t soldier_move_start_run ;
|
||||||
|
extern mmove_t soldier_move_walk2 ;
|
||||||
|
extern mmove_t soldier_move_walk1 ;
|
||||||
|
extern mmove_t soldier_move_stand3 ;
|
||||||
|
extern mmove_t soldier_move_stand1 ;
|
||||||
|
extern mmove_t sentrybot_move_attack ;
|
||||||
|
extern mmove_t sentrybot_move_pain2 ;
|
||||||
|
extern mmove_t sentrybot_move_pain1 ;
|
||||||
|
extern mmove_t sentrybot_move_jump ;
|
||||||
|
extern mmove_t sentrybot_move_run ;
|
||||||
|
extern mmove_t sentrybot_move_walk ;
|
||||||
|
extern mmove_t sentrybot_move_stand ;
|
||||||
|
extern mmove_t parasite_move_jump ;
|
||||||
|
extern mmove_t parasite_move_death ;
|
||||||
|
extern mmove_t parasite_move_break ;
|
||||||
|
extern mmove_t parasite_move_drain ;
|
||||||
|
extern mmove_t parasite_move_pain1 ;
|
||||||
|
extern mmove_t parasite_move_stop_walk ;
|
||||||
|
extern mmove_t parasite_move_start_walk ;
|
||||||
|
extern mmove_t parasite_move_walk ;
|
||||||
|
extern mmove_t parasite_move_stop_run ;
|
||||||
|
extern mmove_t parasite_move_start_run ;
|
||||||
|
extern mmove_t parasite_move_run ;
|
||||||
|
extern mmove_t parasite_move_stand ;
|
||||||
|
extern mmove_t parasite_move_end_fidget ;
|
||||||
|
extern mmove_t parasite_move_fidget ;
|
||||||
|
extern mmove_t parasite_move_start_fidget ;
|
||||||
|
extern mmove_t mutant_move_fake_jump ;
|
||||||
|
extern mmove_t mutant_move_death2 ;
|
||||||
|
extern mmove_t mutant_move_death1 ;
|
||||||
|
extern mmove_t mutant_move_pain3 ;
|
||||||
|
extern mmove_t mutant_move_pain2 ;
|
||||||
|
extern mmove_t mutant_move_pain1 ;
|
||||||
|
extern mmove_t mutant_move_jump ;
|
||||||
|
extern mmove_t mutant_move_attack ;
|
||||||
|
extern mmove_t mutant_move_run ;
|
||||||
|
extern mmove_t mutant_move_start_walk ;
|
||||||
|
extern mmove_t mutant_move_walk ;
|
||||||
|
extern mmove_t mutant_move_idle ;
|
||||||
|
extern mmove_t mutant_move_stand ;
|
||||||
|
extern mmove_t medic_move_attackCable ;
|
||||||
|
extern mmove_t medic_move_attackBlaster ;
|
||||||
|
extern mmove_t medic_move_attackHyperBlaster ;
|
||||||
|
extern mmove_t medic_move_duck ;
|
||||||
|
extern mmove_t medic_move_death ;
|
||||||
|
extern mmove_t medic_move_pain2 ;
|
||||||
|
extern mmove_t medic_move_pain1 ;
|
||||||
|
extern mmove_t medic_move_run ;
|
||||||
|
extern mmove_t medic_move_walk ;
|
||||||
|
extern mmove_t medic_move_stand ;
|
||||||
|
extern mmove_t insane_move_struggle_cross ;
|
||||||
|
extern mmove_t insane_move_cross ;
|
||||||
|
extern mmove_t insane_move_crawl_death ;
|
||||||
|
extern mmove_t insane_move_crawl_pain ;
|
||||||
|
extern mmove_t insane_move_runcrawl ;
|
||||||
|
extern mmove_t insane_move_crawl ;
|
||||||
|
extern mmove_t insane_move_stand_death ;
|
||||||
|
extern mmove_t insane_move_stand_pain ;
|
||||||
|
extern mmove_t insane_move_run_insane ;
|
||||||
|
extern mmove_t insane_move_walk_insane ;
|
||||||
|
extern mmove_t insane_move_run_normal ;
|
||||||
|
extern mmove_t insane_move_walk_normal ;
|
||||||
|
extern mmove_t insane_move_down ;
|
||||||
|
extern mmove_t insane_move_jumpdown ;
|
||||||
|
extern mmove_t insane_move_downtoup ;
|
||||||
|
extern mmove_t insane_move_uptodown ;
|
||||||
|
extern mmove_t insane_move_stand_insane ;
|
||||||
|
extern mmove_t insane_move_stand_normal ;
|
||||||
|
extern mmove_t infantry_move_jump ;
|
||||||
|
extern mmove_t infantry_move_attack2 ;
|
||||||
|
extern mmove_t infantry_move_attack1 ;
|
||||||
|
extern mmove_t infantry_move_roll ;
|
||||||
|
extern mmove_t infantry_move_duck ;
|
||||||
|
extern mmove_t infantry_move_death4 ;
|
||||||
|
extern mmove_t infantry_move_death3 ;
|
||||||
|
extern mmove_t infantry_move_death2 ;
|
||||||
|
extern mmove_t infantry_move_death1 ;
|
||||||
|
extern mmove_t infantry_move_pain2 ;
|
||||||
|
extern mmove_t infantry_move_pain1 ;
|
||||||
|
extern mmove_t infantry_move_run ;
|
||||||
|
extern mmove_t infantry_move_walk ;
|
||||||
|
extern mmove_t infantry_move_fidget ;
|
||||||
|
extern mmove_t infantry_move_stand ;
|
||||||
|
extern mmove_t hover_move_end_attack ;
|
||||||
|
extern mmove_t hover_move_attack2 ;
|
||||||
|
extern mmove_t hover_move_attack1 ;
|
||||||
|
extern mmove_t hover_move_start_attack ;
|
||||||
|
extern mmove_t hover_move_backward ;
|
||||||
|
extern mmove_t hover_move_death1 ;
|
||||||
|
extern mmove_t hover_move_run ;
|
||||||
|
extern mmove_t hover_move_walk ;
|
||||||
|
extern mmove_t hover_move_forward ;
|
||||||
|
extern mmove_t hover_move_land ;
|
||||||
|
extern mmove_t hover_move_pain1 ;
|
||||||
|
extern mmove_t hover_move_pain2 ;
|
||||||
|
extern mmove_t hover_move_pain3 ;
|
||||||
|
extern mmove_t hover_move_takeoff ;
|
||||||
|
extern mmove_t hover_move_stop2 ;
|
||||||
|
extern mmove_t hover_move_stop1 ;
|
||||||
|
extern mmove_t hover_move_stand ;
|
||||||
|
extern mmove_t gunner_move_jump ;
|
||||||
|
extern mmove_t gunner_move_attack_grenade ;
|
||||||
|
extern mmove_t gunner_move_endfire_chain ;
|
||||||
|
extern mmove_t gunner_move_fire_chain ;
|
||||||
|
extern mmove_t gunner_move_attack_chain ;
|
||||||
|
extern mmove_t gunner_move_duck ;
|
||||||
|
extern mmove_t gunner_move_death ;
|
||||||
|
extern mmove_t gunner_move_pain1 ;
|
||||||
|
extern mmove_t gunner_move_pain2 ;
|
||||||
|
extern mmove_t gunner_move_pain3 ;
|
||||||
|
extern mmove_t gunner_move_runandshoot ;
|
||||||
|
extern mmove_t gunner_move_run ;
|
||||||
|
extern mmove_t gunner_move_walk ;
|
||||||
|
extern mmove_t gunner_move_stand ;
|
||||||
|
extern mmove_t gunner_move_fidget ;
|
||||||
|
extern mmove_t gladiator_move_death ;
|
||||||
|
extern mmove_t gladiator_move_pain_air ;
|
||||||
|
extern mmove_t gladiator_move_pain ;
|
||||||
|
extern mmove_t gladiator_move_attack_gun ;
|
||||||
|
extern mmove_t gladiator_move_attack_melee ;
|
||||||
|
extern mmove_t gladiator_move_run ;
|
||||||
|
extern mmove_t gladiator_move_walk ;
|
||||||
|
extern mmove_t gladiator_move_stand ;
|
||||||
|
extern mmove_t flyer_move_loop_melee ;
|
||||||
|
extern mmove_t flyer_move_end_melee ;
|
||||||
|
extern mmove_t flyer_move_start_melee ;
|
||||||
|
extern mmove_t flyer_move_attack2 ;
|
||||||
|
extern mmove_t flyer_move_bankleft ;
|
||||||
|
extern mmove_t flyer_move_bankright ;
|
||||||
|
extern mmove_t flyer_move_defense ;
|
||||||
|
extern mmove_t flyer_move_pain1 ;
|
||||||
|
extern mmove_t flyer_move_pain2 ;
|
||||||
|
extern mmove_t flyer_move_pain3 ;
|
||||||
|
extern mmove_t flyer_move_rollleft ;
|
||||||
|
extern mmove_t flyer_move_rollright ;
|
||||||
|
extern mmove_t flyer_move_stop ;
|
||||||
|
extern mmove_t flyer_move_start ;
|
||||||
|
extern mmove_t flyer_move_run ;
|
||||||
|
extern mmove_t flyer_move_walk ;
|
||||||
|
extern mmove_t flyer_move_stand ;
|
||||||
|
extern mmove_t floater_move_run ;
|
||||||
|
extern mmove_t floater_move_walk ;
|
||||||
|
extern mmove_t floater_move_pain3 ;
|
||||||
|
extern mmove_t floater_move_pain2 ;
|
||||||
|
extern mmove_t floater_move_pain1 ;
|
||||||
|
extern mmove_t floater_move_death ;
|
||||||
|
extern mmove_t floater_move_attack3 ;
|
||||||
|
extern mmove_t floater_move_attack2 ;
|
||||||
|
extern mmove_t floater_move_attack1 ;
|
||||||
|
extern mmove_t floater_move_activate ;
|
||||||
|
extern mmove_t floater_move_stand2 ;
|
||||||
|
extern mmove_t floater_move_stand1 ;
|
||||||
|
extern mmove_t flipper_move_death ;
|
||||||
|
extern mmove_t flipper_move_attack ;
|
||||||
|
extern mmove_t flipper_move_pain1 ;
|
||||||
|
extern mmove_t flipper_move_pain2 ;
|
||||||
|
extern mmove_t flipper_move_start_run ;
|
||||||
|
extern mmove_t flipper_move_walk ;
|
||||||
|
extern mmove_t flipper_move_run_start ;
|
||||||
|
extern mmove_t flipper_move_run_loop ;
|
||||||
|
extern mmove_t flipper_move_stand ;
|
||||||
|
extern mmove_t chick_move_start_slash ;
|
||||||
|
extern mmove_t chick_move_end_slash ;
|
||||||
|
extern mmove_t chick_move_slash ;
|
||||||
|
extern mmove_t chick_move_end_attack1 ;
|
||||||
|
extern mmove_t chick_move_attack1 ;
|
||||||
|
extern mmove_t chick_move_start_attack1 ;
|
||||||
|
extern mmove_t chick_move_backflip ;
|
||||||
|
extern mmove_t chick_move_duck ;
|
||||||
|
extern mmove_t chick_move_death1 ;
|
||||||
|
extern mmove_t chick_move_death2 ;
|
||||||
|
extern mmove_t chick_move_pain3 ;
|
||||||
|
extern mmove_t chick_move_pain2 ;
|
||||||
|
extern mmove_t chick_move_pain1 ;
|
||||||
|
extern mmove_t chick_move_walk ;
|
||||||
|
extern mmove_t chick_move_run ;
|
||||||
|
extern mmove_t chick_move_start_run ;
|
||||||
|
extern mmove_t chick_move_stand ;
|
||||||
|
extern mmove_t chick_move_fidget ;
|
||||||
|
extern mmove_t brain_move_preattack_drain ;
|
||||||
|
extern mmove_t brain_move_attack_drain ;
|
||||||
|
extern mmove_t brain_move_attack_plasma ;
|
||||||
|
extern mmove_t brain_move_run ;
|
||||||
|
extern mmove_t brain_move_attack3 ;
|
||||||
|
extern mmove_t brain_move_attack2 ;
|
||||||
|
extern mmove_t brain_move_attack1 ;
|
||||||
|
extern mmove_t brain_move_death1 ;
|
||||||
|
extern mmove_t brain_move_death2 ;
|
||||||
|
extern mmove_t brain_move_duck ;
|
||||||
|
extern mmove_t brain_move_pain1 ;
|
||||||
|
extern mmove_t brain_move_pain2 ;
|
||||||
|
extern mmove_t brain_move_pain3 ;
|
||||||
|
extern mmove_t brain_move_defense ;
|
||||||
|
extern mmove_t brain_move_walk2 ;
|
||||||
|
extern mmove_t brain_move_walk1 ;
|
||||||
|
extern mmove_t brain_move_idle ;
|
||||||
|
extern mmove_t brain_move_stand ;
|
||||||
|
extern mmove_t makron_move_attack5 ;
|
||||||
|
extern mmove_t makron_move_attack4 ;
|
||||||
|
extern mmove_t makron_move_attack3 ;
|
||||||
|
extern mmove_t makron_move_sight ;
|
||||||
|
extern mmove_t makron_move_death3 ;
|
||||||
|
extern mmove_t makron_move_death2 ;
|
||||||
|
extern mmove_t makron_move_pain4 ;
|
||||||
|
extern mmove_t makron_move_pain5 ;
|
||||||
|
extern mmove_t makron_move_pain6 ;
|
||||||
|
extern mmove_t makron_move_walk ;
|
||||||
|
extern mmove_t makron_move_run ;
|
||||||
|
extern mmove_t makron_move_stand ;
|
||||||
|
extern mmove_t jorg_move_end_attack1 ;
|
||||||
|
extern mmove_t jorg_move_attack1 ;
|
||||||
|
extern mmove_t jorg_move_start_attack1 ;
|
||||||
|
extern mmove_t jorg_move_attack2 ;
|
||||||
|
extern mmove_t jorg_move_death ;
|
||||||
|
extern mmove_t jorg_move_pain1 ;
|
||||||
|
extern mmove_t jorg_move_pain2 ;
|
||||||
|
extern mmove_t jorg_move_pain3 ;
|
||||||
|
extern mmove_t jorg_move_end_walk ;
|
||||||
|
extern mmove_t jorg_move_walk ;
|
||||||
|
extern mmove_t jorg_move_start_walk ;
|
||||||
|
extern mmove_t jorg_move_run ;
|
||||||
|
extern mmove_t jorg_move_stand ;
|
||||||
|
extern mmove_t boss2_move_death ;
|
||||||
|
extern mmove_t boss2_move_pain_light ;
|
||||||
|
extern mmove_t boss2_move_pain_heavy ;
|
||||||
|
extern mmove_t boss2_move_attack_rocket ;
|
||||||
|
extern mmove_t boss2_move_attack_post_mg ;
|
||||||
|
extern mmove_t boss2_move_attack_mg ;
|
||||||
|
extern mmove_t boss2_move_attack_pre_mg ;
|
||||||
|
extern mmove_t boss2_move_run ;
|
||||||
|
extern mmove_t boss2_move_walk ;
|
||||||
|
extern mmove_t boss2_move_fidget ;
|
||||||
|
extern mmove_t boss2_move_stand ;
|
||||||
|
extern mmove_t berserk_move_jump ;
|
||||||
|
extern mmove_t berserk_move_death2 ;
|
||||||
|
extern mmove_t berserk_move_death1 ;
|
||||||
|
extern mmove_t berserk_move_pain2 ;
|
||||||
|
extern mmove_t berserk_move_pain1 ;
|
||||||
|
extern mmove_t berserk_move_attack_strike ;
|
||||||
|
extern mmove_t berserk_move_attack_club ;
|
||||||
|
extern mmove_t berserk_move_attack_spike ;
|
||||||
|
extern mmove_t berserk_move_run1 ;
|
||||||
|
extern mmove_t berserk_move_walk ;
|
||||||
|
extern mmove_t berserk_move_stand_fidget ;
|
||||||
|
extern mmove_t berserk_move_stand ;
|
||||||
|
extern mmove_t actor_move_salute ;
|
||||||
|
extern mmove_t actor_move_jump ;
|
||||||
|
extern mmove_t actor_move_crattack ;
|
||||||
|
extern mmove_t actor_move_attack ;
|
||||||
|
extern mmove_t actor_move_death2 ;
|
||||||
|
extern mmove_t actor_move_death1 ;
|
||||||
|
extern mmove_t actor_move_switch ;
|
||||||
|
extern mmove_t actor_move_taunt ;
|
||||||
|
extern mmove_t actor_move_flipoff ;
|
||||||
|
extern mmove_t actor_move_pain3 ;
|
||||||
|
extern mmove_t actor_move_pain2 ;
|
||||||
|
extern mmove_t actor_move_pain1 ;
|
||||||
|
extern mmove_t mmove_reloc ;
|
||||||
|
extern mmove_t actor_move_walk_back ;
|
||||||
|
extern mmove_t actor_move_walk ;
|
||||||
|
extern mmove_t actor_move_stand ;
|
||||||
|
extern mmove_t actor_move_run_bad ;
|
||||||
|
extern mmove_t actor_move_run_back ;
|
||||||
|
extern mmove_t actor_move_run ;
|
||||||
|
extern mmove_t actor_move_crouchwalk_back ;
|
||||||
|
extern mmove_t actor_move_crouchwalk ;
|
||||||
|
extern mmove_t actor_move_crouch ;
|
320
src/g_mmove_list.h
Normal file
320
src/g_mmove_list.h
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
{"tank_move_death", &tank_move_death},
|
||||||
|
{"tank_move_attack_chain", &tank_move_attack_chain},
|
||||||
|
{"tank_move_attack_post_rocket", &tank_move_attack_post_rocket},
|
||||||
|
{"tank_move_attack_fire_rocket", &tank_move_attack_fire_rocket},
|
||||||
|
{"tank_move_attack_pre_rocket", &tank_move_attack_pre_rocket},
|
||||||
|
{"tank_move_attack_strike", &tank_move_attack_strike},
|
||||||
|
{"tank_move_attack_post_blast", &tank_move_attack_post_blast},
|
||||||
|
{"tank_move_reattack_blast", &tank_move_reattack_blast},
|
||||||
|
{"tank_move_attack_blast", &tank_move_attack_blast},
|
||||||
|
{"tank_move_pain3", &tank_move_pain3},
|
||||||
|
{"tank_move_pain2", &tank_move_pain2},
|
||||||
|
{"tank_move_pain1", &tank_move_pain1},
|
||||||
|
{"tank_move_stop_run", &tank_move_stop_run},
|
||||||
|
{"tank_move_run", &tank_move_run},
|
||||||
|
{"tank_move_start_run", &tank_move_start_run},
|
||||||
|
{"tank_move_stop_walk", &tank_move_stop_walk},
|
||||||
|
{"tank_move_walk", &tank_move_walk},
|
||||||
|
{"tank_move_start_walk", &tank_move_start_walk},
|
||||||
|
{"tank_move_stand", &tank_move_stand},
|
||||||
|
{"supertank_move_end_attack1", &supertank_move_end_attack1},
|
||||||
|
{"supertank_move_attack1", &supertank_move_attack1},
|
||||||
|
{"supertank_move_attack2", &supertank_move_attack2},
|
||||||
|
{"supertank_move_attack3", &supertank_move_attack3},
|
||||||
|
{"supertank_move_attack4", &supertank_move_attack4},
|
||||||
|
{"supertank_move_backward", &supertank_move_backward},
|
||||||
|
{"supertank_move_death", &supertank_move_death},
|
||||||
|
{"supertank_move_pain1", &supertank_move_pain1},
|
||||||
|
{"supertank_move_pain2", &supertank_move_pain2},
|
||||||
|
{"supertank_move_pain3", &supertank_move_pain3},
|
||||||
|
{"supertank_move_turn_left", &supertank_move_turn_left},
|
||||||
|
{"supertank_move_turn_right", &supertank_move_turn_right},
|
||||||
|
{"supertank_move_forward", &supertank_move_forward},
|
||||||
|
{"supertank_move_run", &supertank_move_run},
|
||||||
|
{"supertank_move_stand", &supertank_move_stand},
|
||||||
|
{"soldier_move_jump", &soldier_move_jump},
|
||||||
|
{"soldier_move_death6", &soldier_move_death6},
|
||||||
|
{"soldier_move_death5", &soldier_move_death5},
|
||||||
|
{"soldier_move_death4", &soldier_move_death4},
|
||||||
|
{"soldier_move_death3", &soldier_move_death3},
|
||||||
|
{"soldier_move_death2", &soldier_move_death2},
|
||||||
|
{"soldier_move_death1", &soldier_move_death1},
|
||||||
|
{"soldier_move_duck", &soldier_move_duck},
|
||||||
|
{"soldier_move_attack6", &soldier_move_attack6},
|
||||||
|
{"soldier_move_attack4", &soldier_move_attack4},
|
||||||
|
{"soldier_move_attack3", &soldier_move_attack3},
|
||||||
|
{"soldier_move_attack2", &soldier_move_attack2},
|
||||||
|
{"soldier_move_attack1", &soldier_move_attack1},
|
||||||
|
{"soldier_move_pain4", &soldier_move_pain4},
|
||||||
|
{"soldier_move_pain3", &soldier_move_pain3},
|
||||||
|
{"soldier_move_pain2", &soldier_move_pain2},
|
||||||
|
{"soldier_move_pain1", &soldier_move_pain1},
|
||||||
|
{"soldier_move_run", &soldier_move_run},
|
||||||
|
{"soldier_move_start_run", &soldier_move_start_run},
|
||||||
|
{"soldier_move_walk2", &soldier_move_walk2},
|
||||||
|
{"soldier_move_walk1", &soldier_move_walk1},
|
||||||
|
{"soldier_move_stand3", &soldier_move_stand3},
|
||||||
|
{"soldier_move_stand1", &soldier_move_stand1},
|
||||||
|
{"sentrybot_move_attack", &sentrybot_move_attack},
|
||||||
|
{"sentrybot_move_pain2", &sentrybot_move_pain2},
|
||||||
|
{"sentrybot_move_pain1", &sentrybot_move_pain1},
|
||||||
|
{"sentrybot_move_jump", &sentrybot_move_jump},
|
||||||
|
{"sentrybot_move_run", &sentrybot_move_run},
|
||||||
|
{"sentrybot_move_walk", &sentrybot_move_walk},
|
||||||
|
{"sentrybot_move_stand", &sentrybot_move_stand},
|
||||||
|
{"parasite_move_jump", ¶site_move_jump},
|
||||||
|
{"parasite_move_death", ¶site_move_death},
|
||||||
|
{"parasite_move_break", ¶site_move_break},
|
||||||
|
{"parasite_move_drain", ¶site_move_drain},
|
||||||
|
{"parasite_move_pain1", ¶site_move_pain1},
|
||||||
|
{"parasite_move_stop_walk", ¶site_move_stop_walk},
|
||||||
|
{"parasite_move_start_walk", ¶site_move_start_walk},
|
||||||
|
{"parasite_move_walk", ¶site_move_walk},
|
||||||
|
{"parasite_move_stop_run", ¶site_move_stop_run},
|
||||||
|
{"parasite_move_start_run", ¶site_move_start_run},
|
||||||
|
{"parasite_move_run", ¶site_move_run},
|
||||||
|
{"parasite_move_stand", ¶site_move_stand},
|
||||||
|
{"parasite_move_end_fidget", ¶site_move_end_fidget},
|
||||||
|
{"parasite_move_fidget", ¶site_move_fidget},
|
||||||
|
{"parasite_move_start_fidget", ¶site_move_start_fidget},
|
||||||
|
{"mutant_move_fake_jump", &mutant_move_fake_jump},
|
||||||
|
{"mutant_move_death2", &mutant_move_death2},
|
||||||
|
{"mutant_move_death1", &mutant_move_death1},
|
||||||
|
{"mutant_move_pain3", &mutant_move_pain3},
|
||||||
|
{"mutant_move_pain2", &mutant_move_pain2},
|
||||||
|
{"mutant_move_pain1", &mutant_move_pain1},
|
||||||
|
{"mutant_move_jump", &mutant_move_jump},
|
||||||
|
{"mutant_move_attack", &mutant_move_attack},
|
||||||
|
{"mutant_move_run", &mutant_move_run},
|
||||||
|
{"mutant_move_start_walk", &mutant_move_start_walk},
|
||||||
|
{"mutant_move_walk", &mutant_move_walk},
|
||||||
|
{"mutant_move_idle", &mutant_move_idle},
|
||||||
|
{"mutant_move_stand", &mutant_move_stand},
|
||||||
|
{"medic_move_attackCable", &medic_move_attackCable},
|
||||||
|
{"medic_move_attackBlaster", &medic_move_attackBlaster},
|
||||||
|
{"medic_move_attackHyperBlaster", &medic_move_attackHyperBlaster},
|
||||||
|
{"medic_move_duck", &medic_move_duck},
|
||||||
|
{"medic_move_death", &medic_move_death},
|
||||||
|
{"medic_move_pain2", &medic_move_pain2},
|
||||||
|
{"medic_move_pain1", &medic_move_pain1},
|
||||||
|
{"medic_move_run", &medic_move_run},
|
||||||
|
{"medic_move_walk", &medic_move_walk},
|
||||||
|
{"medic_move_stand", &medic_move_stand},
|
||||||
|
{"insane_move_struggle_cross", &insane_move_struggle_cross},
|
||||||
|
{"insane_move_cross", &insane_move_cross},
|
||||||
|
{"insane_move_crawl_death", &insane_move_crawl_death},
|
||||||
|
{"insane_move_crawl_pain", &insane_move_crawl_pain},
|
||||||
|
{"insane_move_runcrawl", &insane_move_runcrawl},
|
||||||
|
{"insane_move_crawl", &insane_move_crawl},
|
||||||
|
{"insane_move_stand_death", &insane_move_stand_death},
|
||||||
|
{"insane_move_stand_pain", &insane_move_stand_pain},
|
||||||
|
{"insane_move_run_insane", &insane_move_run_insane},
|
||||||
|
{"insane_move_walk_insane", &insane_move_walk_insane},
|
||||||
|
{"insane_move_run_normal", &insane_move_run_normal},
|
||||||
|
{"insane_move_walk_normal", &insane_move_walk_normal},
|
||||||
|
{"insane_move_down", &insane_move_down},
|
||||||
|
{"insane_move_jumpdown", &insane_move_jumpdown},
|
||||||
|
{"insane_move_downtoup", &insane_move_downtoup},
|
||||||
|
{"insane_move_uptodown", &insane_move_uptodown},
|
||||||
|
{"insane_move_stand_insane", &insane_move_stand_insane},
|
||||||
|
{"insane_move_stand_normal", &insane_move_stand_normal},
|
||||||
|
{"infantry_move_jump", &infantry_move_jump},
|
||||||
|
{"infantry_move_attack2", &infantry_move_attack2},
|
||||||
|
{"infantry_move_attack1", &infantry_move_attack1},
|
||||||
|
{"infantry_move_roll", &infantry_move_roll},
|
||||||
|
{"infantry_move_duck", &infantry_move_duck},
|
||||||
|
{"infantry_move_death4", &infantry_move_death4},
|
||||||
|
{"infantry_move_death3", &infantry_move_death3},
|
||||||
|
{"infantry_move_death2", &infantry_move_death2},
|
||||||
|
{"infantry_move_death1", &infantry_move_death1},
|
||||||
|
{"infantry_move_pain2", &infantry_move_pain2},
|
||||||
|
{"infantry_move_pain1", &infantry_move_pain1},
|
||||||
|
{"infantry_move_run", &infantry_move_run},
|
||||||
|
{"infantry_move_walk", &infantry_move_walk},
|
||||||
|
{"infantry_move_fidget", &infantry_move_fidget},
|
||||||
|
{"infantry_move_stand", &infantry_move_stand},
|
||||||
|
{"hover_move_end_attack", &hover_move_end_attack},
|
||||||
|
{"hover_move_attack2", &hover_move_attack2},
|
||||||
|
{"hover_move_attack1", &hover_move_attack1},
|
||||||
|
{"hover_move_start_attack", &hover_move_start_attack},
|
||||||
|
{"hover_move_backward", &hover_move_backward},
|
||||||
|
{"hover_move_death1", &hover_move_death1},
|
||||||
|
{"hover_move_run", &hover_move_run},
|
||||||
|
{"hover_move_walk", &hover_move_walk},
|
||||||
|
{"hover_move_forward", &hover_move_forward},
|
||||||
|
{"hover_move_land", &hover_move_land},
|
||||||
|
{"hover_move_pain1", &hover_move_pain1},
|
||||||
|
{"hover_move_pain2", &hover_move_pain2},
|
||||||
|
{"hover_move_pain3", &hover_move_pain3},
|
||||||
|
{"hover_move_takeoff", &hover_move_takeoff},
|
||||||
|
{"hover_move_stop2", &hover_move_stop2},
|
||||||
|
{"hover_move_stop1", &hover_move_stop1},
|
||||||
|
{"hover_move_stand", &hover_move_stand},
|
||||||
|
{"gunner_move_jump", &gunner_move_jump},
|
||||||
|
{"gunner_move_attack_grenade", &gunner_move_attack_grenade},
|
||||||
|
{"gunner_move_endfire_chain", &gunner_move_endfire_chain},
|
||||||
|
{"gunner_move_fire_chain", &gunner_move_fire_chain},
|
||||||
|
{"gunner_move_attack_chain", &gunner_move_attack_chain},
|
||||||
|
{"gunner_move_duck", &gunner_move_duck},
|
||||||
|
{"gunner_move_death", &gunner_move_death},
|
||||||
|
{"gunner_move_pain1", &gunner_move_pain1},
|
||||||
|
{"gunner_move_pain2", &gunner_move_pain2},
|
||||||
|
{"gunner_move_pain3", &gunner_move_pain3},
|
||||||
|
{"gunner_move_runandshoot", &gunner_move_runandshoot},
|
||||||
|
{"gunner_move_run", &gunner_move_run},
|
||||||
|
{"gunner_move_walk", &gunner_move_walk},
|
||||||
|
{"gunner_move_stand", &gunner_move_stand},
|
||||||
|
{"gunner_move_fidget", &gunner_move_fidget},
|
||||||
|
{"gladiator_move_death", &gladiator_move_death},
|
||||||
|
{"gladiator_move_pain_air", &gladiator_move_pain_air},
|
||||||
|
{"gladiator_move_pain", &gladiator_move_pain},
|
||||||
|
{"gladiator_move_attack_gun", &gladiator_move_attack_gun},
|
||||||
|
{"gladiator_move_attack_melee", &gladiator_move_attack_melee},
|
||||||
|
{"gladiator_move_run", &gladiator_move_run},
|
||||||
|
{"gladiator_move_walk", &gladiator_move_walk},
|
||||||
|
{"gladiator_move_stand", &gladiator_move_stand},
|
||||||
|
{"flyer_move_loop_melee", &flyer_move_loop_melee},
|
||||||
|
{"flyer_move_end_melee", &flyer_move_end_melee},
|
||||||
|
{"flyer_move_start_melee", &flyer_move_start_melee},
|
||||||
|
{"flyer_move_attack2", &flyer_move_attack2},
|
||||||
|
{"flyer_move_bankleft", &flyer_move_bankleft},
|
||||||
|
{"flyer_move_bankright", &flyer_move_bankright},
|
||||||
|
{"flyer_move_defense", &flyer_move_defense},
|
||||||
|
{"flyer_move_pain1", &flyer_move_pain1},
|
||||||
|
{"flyer_move_pain2", &flyer_move_pain2},
|
||||||
|
{"flyer_move_pain3", &flyer_move_pain3},
|
||||||
|
{"flyer_move_rollleft", &flyer_move_rollleft},
|
||||||
|
{"flyer_move_rollright", &flyer_move_rollright},
|
||||||
|
{"flyer_move_stop", &flyer_move_stop},
|
||||||
|
{"flyer_move_start", &flyer_move_start},
|
||||||
|
{"flyer_move_run", &flyer_move_run},
|
||||||
|
{"flyer_move_walk", &flyer_move_walk},
|
||||||
|
{"flyer_move_stand", &flyer_move_stand},
|
||||||
|
{"floater_move_run", &floater_move_run},
|
||||||
|
{"floater_move_walk", &floater_move_walk},
|
||||||
|
{"floater_move_pain3", &floater_move_pain3},
|
||||||
|
{"floater_move_pain2", &floater_move_pain2},
|
||||||
|
{"floater_move_pain1", &floater_move_pain1},
|
||||||
|
{"floater_move_death", &floater_move_death},
|
||||||
|
{"floater_move_attack3", &floater_move_attack3},
|
||||||
|
{"floater_move_attack2", &floater_move_attack2},
|
||||||
|
{"floater_move_attack1", &floater_move_attack1},
|
||||||
|
{"floater_move_activate", &floater_move_activate},
|
||||||
|
{"floater_move_stand2", &floater_move_stand2},
|
||||||
|
{"floater_move_stand1", &floater_move_stand1},
|
||||||
|
{"flipper_move_death", &flipper_move_death},
|
||||||
|
{"flipper_move_attack", &flipper_move_attack},
|
||||||
|
{"flipper_move_pain1", &flipper_move_pain1},
|
||||||
|
{"flipper_move_pain2", &flipper_move_pain2},
|
||||||
|
{"flipper_move_start_run", &flipper_move_start_run},
|
||||||
|
{"flipper_move_walk", &flipper_move_walk},
|
||||||
|
{"flipper_move_run_start", &flipper_move_run_start},
|
||||||
|
{"flipper_move_run_loop", &flipper_move_run_loop},
|
||||||
|
{"flipper_move_stand", &flipper_move_stand},
|
||||||
|
{"chick_move_start_slash", &chick_move_start_slash},
|
||||||
|
{"chick_move_end_slash", &chick_move_end_slash},
|
||||||
|
{"chick_move_slash", &chick_move_slash},
|
||||||
|
{"chick_move_end_attack1", &chick_move_end_attack1},
|
||||||
|
{"chick_move_attack1", &chick_move_attack1},
|
||||||
|
{"chick_move_start_attack1", &chick_move_start_attack1},
|
||||||
|
{"chick_move_backflip", &chick_move_backflip},
|
||||||
|
{"chick_move_duck", &chick_move_duck},
|
||||||
|
{"chick_move_death1", &chick_move_death1},
|
||||||
|
{"chick_move_death2", &chick_move_death2},
|
||||||
|
{"chick_move_pain3", &chick_move_pain3},
|
||||||
|
{"chick_move_pain2", &chick_move_pain2},
|
||||||
|
{"chick_move_pain1", &chick_move_pain1},
|
||||||
|
{"chick_move_walk", &chick_move_walk},
|
||||||
|
{"chick_move_run", &chick_move_run},
|
||||||
|
{"chick_move_start_run", &chick_move_start_run},
|
||||||
|
{"chick_move_stand", &chick_move_stand},
|
||||||
|
{"chick_move_fidget", &chick_move_fidget},
|
||||||
|
{"brain_move_preattack_drain", &brain_move_preattack_drain},
|
||||||
|
{"brain_move_attack_drain", &brain_move_attack_drain},
|
||||||
|
{"brain_move_attack_plasma", &brain_move_attack_plasma},
|
||||||
|
{"brain_move_run", &brain_move_run},
|
||||||
|
{"brain_move_attack3", &brain_move_attack3},
|
||||||
|
{"brain_move_attack2", &brain_move_attack2},
|
||||||
|
{"brain_move_attack1", &brain_move_attack1},
|
||||||
|
{"brain_move_death1", &brain_move_death1},
|
||||||
|
{"brain_move_death2", &brain_move_death2},
|
||||||
|
{"brain_move_duck", &brain_move_duck},
|
||||||
|
{"brain_move_pain1", &brain_move_pain1},
|
||||||
|
{"brain_move_pain2", &brain_move_pain2},
|
||||||
|
{"brain_move_pain3", &brain_move_pain3},
|
||||||
|
{"brain_move_defense", &brain_move_defense},
|
||||||
|
{"brain_move_walk2", &brain_move_walk2},
|
||||||
|
{"brain_move_walk1", &brain_move_walk1},
|
||||||
|
{"brain_move_idle", &brain_move_idle},
|
||||||
|
{"brain_move_stand", &brain_move_stand},
|
||||||
|
{"makron_move_attack5", &makron_move_attack5},
|
||||||
|
{"makron_move_attack4", &makron_move_attack4},
|
||||||
|
{"makron_move_attack3", &makron_move_attack3},
|
||||||
|
{"makron_move_sight", &makron_move_sight},
|
||||||
|
{"makron_move_death3", &makron_move_death3},
|
||||||
|
{"makron_move_death2", &makron_move_death2},
|
||||||
|
{"makron_move_pain4", &makron_move_pain4},
|
||||||
|
{"makron_move_pain5", &makron_move_pain5},
|
||||||
|
{"makron_move_pain6", &makron_move_pain6},
|
||||||
|
{"makron_move_walk", &makron_move_walk},
|
||||||
|
{"makron_move_run", &makron_move_run},
|
||||||
|
{"makron_move_stand", &makron_move_stand},
|
||||||
|
{"jorg_move_end_attack1", &jorg_move_end_attack1},
|
||||||
|
{"jorg_move_attack1", &jorg_move_attack1},
|
||||||
|
{"jorg_move_start_attack1", &jorg_move_start_attack1},
|
||||||
|
{"jorg_move_attack2", &jorg_move_attack2},
|
||||||
|
{"jorg_move_death", &jorg_move_death},
|
||||||
|
{"jorg_move_pain1", &jorg_move_pain1},
|
||||||
|
{"jorg_move_pain2", &jorg_move_pain2},
|
||||||
|
{"jorg_move_pain3", &jorg_move_pain3},
|
||||||
|
{"jorg_move_end_walk", &jorg_move_end_walk},
|
||||||
|
{"jorg_move_walk", &jorg_move_walk},
|
||||||
|
{"jorg_move_start_walk", &jorg_move_start_walk},
|
||||||
|
{"jorg_move_run", &jorg_move_run},
|
||||||
|
{"jorg_move_stand", &jorg_move_stand},
|
||||||
|
{"boss2_move_death", &boss2_move_death},
|
||||||
|
{"boss2_move_pain_light", &boss2_move_pain_light},
|
||||||
|
{"boss2_move_pain_heavy", &boss2_move_pain_heavy},
|
||||||
|
{"boss2_move_attack_rocket", &boss2_move_attack_rocket},
|
||||||
|
{"boss2_move_attack_post_mg", &boss2_move_attack_post_mg},
|
||||||
|
{"boss2_move_attack_mg", &boss2_move_attack_mg},
|
||||||
|
{"boss2_move_attack_pre_mg", &boss2_move_attack_pre_mg},
|
||||||
|
{"boss2_move_run", &boss2_move_run},
|
||||||
|
{"boss2_move_walk", &boss2_move_walk},
|
||||||
|
{"boss2_move_fidget", &boss2_move_fidget},
|
||||||
|
{"boss2_move_stand", &boss2_move_stand},
|
||||||
|
{"berserk_move_jump", &berserk_move_jump},
|
||||||
|
{"berserk_move_death2", &berserk_move_death2},
|
||||||
|
{"berserk_move_death1", &berserk_move_death1},
|
||||||
|
{"berserk_move_pain2", &berserk_move_pain2},
|
||||||
|
{"berserk_move_pain1", &berserk_move_pain1},
|
||||||
|
{"berserk_move_attack_strike", &berserk_move_attack_strike},
|
||||||
|
{"berserk_move_attack_club", &berserk_move_attack_club},
|
||||||
|
{"berserk_move_attack_spike", &berserk_move_attack_spike},
|
||||||
|
{"berserk_move_run1", &berserk_move_run1},
|
||||||
|
{"berserk_move_walk", &berserk_move_walk},
|
||||||
|
{"berserk_move_stand_fidget", &berserk_move_stand_fidget},
|
||||||
|
{"berserk_move_stand", &berserk_move_stand},
|
||||||
|
{"actor_move_salute", &actor_move_salute},
|
||||||
|
{"actor_move_jump", &actor_move_jump},
|
||||||
|
{"actor_move_crattack", &actor_move_crattack},
|
||||||
|
{"actor_move_attack", &actor_move_attack},
|
||||||
|
{"actor_move_death2", &actor_move_death2},
|
||||||
|
{"actor_move_death1", &actor_move_death1},
|
||||||
|
{"actor_move_switch", &actor_move_switch},
|
||||||
|
{"actor_move_taunt", &actor_move_taunt},
|
||||||
|
{"actor_move_flipoff", &actor_move_flipoff},
|
||||||
|
{"actor_move_pain3", &actor_move_pain3},
|
||||||
|
{"actor_move_pain2", &actor_move_pain2},
|
||||||
|
{"actor_move_pain1", &actor_move_pain1},
|
||||||
|
{"mmove_reloc", &mmove_reloc},
|
||||||
|
{"actor_move_walk_back", &actor_move_walk_back},
|
||||||
|
{"actor_move_walk", &actor_move_walk},
|
||||||
|
{"actor_move_stand", &actor_move_stand},
|
||||||
|
{"actor_move_run_bad", &actor_move_run_bad},
|
||||||
|
{"actor_move_run_back", &actor_move_run_back},
|
||||||
|
{"actor_move_run", &actor_move_run},
|
||||||
|
{"actor_move_crouchwalk_back", &actor_move_crouchwalk_back},
|
||||||
|
{"actor_move_crouchwalk", &actor_move_crouchwalk},
|
||||||
|
{"actor_move_crouch", &actor_move_crouch},
|
||||||
|
{0, 0}
|
|
@ -1050,7 +1050,7 @@ void InitiallyDead (edict_t *self)
|
||||||
#define MAX_SKINS 16
|
#define MAX_SKINS 16
|
||||||
#define MAX_SKINNAME 64
|
#define MAX_SKINNAME 64
|
||||||
|
|
||||||
#include <direct.h>
|
//#include <direct.h>
|
||||||
#include "pak.h"
|
#include "pak.h"
|
||||||
|
|
||||||
int PatchMonsterModel (char *modelname)
|
int PatchMonsterModel (char *modelname)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// PatchPlayerModels (ent);
|
// PatchPlayerModels (ent);
|
||||||
|
|
||||||
|
|
||||||
#include <direct.h>
|
//#include <direct.h>
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
||||||
//
|
//
|
||||||
int PatchPlayerModels (char *modelname)
|
int PatchPlayerModels (char *modelname)
|
||||||
{
|
{
|
||||||
|
return 1;
|
||||||
|
|
||||||
cvar_t *game;
|
cvar_t *game;
|
||||||
int j;
|
int j;
|
||||||
int numskins; // number of skin entries
|
int numskins; // number of skin entries
|
||||||
|
|
251
src/g_save.c
251
src/g_save.c
|
@ -3,6 +3,14 @@
|
||||||
|
|
||||||
#define Function(f) {#f, f}
|
#define Function(f) {#f, f}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#define SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SAVEGAME_DLLNAME "Lazarus Quake II mod for SMD"
|
||||||
|
#define SAVEGAME_VERSION 1
|
||||||
|
|
||||||
mmove_t mmove_reloc;
|
mmove_t mmove_reloc;
|
||||||
|
|
||||||
field_t fields[] = {
|
field_t fields[] = {
|
||||||
|
@ -39,7 +47,6 @@ field_t fields[] = {
|
||||||
{"origin", FOFS(s.origin), F_VECTOR},
|
{"origin", FOFS(s.origin), F_VECTOR},
|
||||||
{"angles", FOFS(s.angles), F_VECTOR},
|
{"angles", FOFS(s.angles), F_VECTOR},
|
||||||
{"angle", FOFS(s.angles), F_ANGLEHACK},
|
{"angle", FOFS(s.angles), F_ANGLEHACK},
|
||||||
|
|
||||||
{"goalentity", FOFS(goalentity), F_EDICT, FFL_NOSPAWN},
|
{"goalentity", FOFS(goalentity), F_EDICT, FFL_NOSPAWN},
|
||||||
{"movetarget", FOFS(movetarget), F_EDICT, FFL_NOSPAWN},
|
{"movetarget", FOFS(movetarget), F_EDICT, FFL_NOSPAWN},
|
||||||
{"enemy", FOFS(enemy), F_EDICT, FFL_NOSPAWN},
|
{"enemy", FOFS(enemy), F_EDICT, FFL_NOSPAWN},
|
||||||
|
@ -209,10 +216,14 @@ field_t fields[] = {
|
||||||
{"badMedic2", FOFS(monsterinfo.badMedic2), F_EDICT},
|
{"badMedic2", FOFS(monsterinfo.badMedic2), F_EDICT},
|
||||||
{"last_player_enemy", FOFS(monsterinfo.last_player_enemy), F_EDICT},
|
{"last_player_enemy", FOFS(monsterinfo.last_player_enemy), F_EDICT},
|
||||||
{"commander", FOFS(monsterinfo.commander), F_EDICT},
|
{"commander", FOFS(monsterinfo.commander), F_EDICT},
|
||||||
{"blocked", FOFS(monsterinfo.blocked), F_MMOVE, FFL_NOSPAWN},
|
{"blocked", FOFS(monsterinfo.blocked), F_FUNCTION, FFL_NOSPAWN},
|
||||||
{"duck", FOFS(monsterinfo.duck), F_MMOVE, FFL_NOSPAWN},
|
{"duck", FOFS(monsterinfo.duck), F_FUNCTION, FFL_NOSPAWN},
|
||||||
{"unduck", FOFS(monsterinfo.unduck), F_MMOVE, FFL_NOSPAWN},
|
{"unduck", FOFS(monsterinfo.unduck), F_FUNCTION, FFL_NOSPAWN},
|
||||||
{"sidestep", FOFS(monsterinfo.sidestep), F_MMOVE, FFL_NOSPAWN},
|
{"sidestep", FOFS(monsterinfo.sidestep), F_FUNCTION, FFL_NOSPAWN},
|
||||||
|
// {"blocked", FOFS(monsterinfo.blocked), F_MMOVE, FFL_NOSPAWN},
|
||||||
|
// {"duck", FOFS(monsterinfo.duck), F_MMOVE, FFL_NOSPAWN},
|
||||||
|
// {"unduck", FOFS(monsterinfo.unduck), F_MMOVE, FFL_NOSPAWN},
|
||||||
|
// {"sidestep", FOFS(monsterinfo.sidestep), F_MMOVE, FFL_NOSPAWN},
|
||||||
// ROGUE
|
// ROGUE
|
||||||
|
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
|
@ -256,15 +267,17 @@ only happens when a new game is started or a save game
|
||||||
is loaded.
|
is loaded.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
|
#ifndef DISABLE_FMOD
|
||||||
void ReadTextureSurfaceAssignments();
|
void ReadTextureSurfaceAssignments();
|
||||||
|
#endif
|
||||||
void InitGame (void)
|
void InitGame (void)
|
||||||
{
|
{
|
||||||
gi.dprintf("==== InitGame ====\n");
|
gi.dprintf("==== InitGame ====\n");
|
||||||
|
|
||||||
//CW++
|
//CW++
|
||||||
|
gi.dprintf("E-mail: musashi.planetquake@gmail.com\n\n");
|
||||||
gi.dprintf("Slight Mechanical Destruction\n");
|
gi.dprintf("Slight Mechanical Destruction\n");
|
||||||
gi.dprintf("by Musashi\n");
|
gi.dprintf("by Musashi\n");
|
||||||
gi.dprintf("E-mail: musashi.planetquake@gmail.com\n\n");
|
|
||||||
//CW--
|
//CW--
|
||||||
|
|
||||||
gun_x = gi.cvar ("gun_x", "0", 0);
|
gun_x = gi.cvar ("gun_x", "0", 0);
|
||||||
|
@ -290,7 +303,10 @@ void InitGame (void)
|
||||||
deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH);
|
deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH);
|
||||||
coop = gi.cvar ("coop", "0", CVAR_LATCH);
|
coop = gi.cvar ("coop", "0", CVAR_LATCH);
|
||||||
skill = gi.cvar ("skill", "1", CVAR_LATCH);
|
skill = gi.cvar ("skill", "1", CVAR_LATCH);
|
||||||
maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);
|
|
||||||
|
//Knightmare- increase maxentities
|
||||||
|
//maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);
|
||||||
|
maxentities = gi.cvar ("maxentities", va("%i",MAX_EDICTS), CVAR_LATCH);
|
||||||
|
|
||||||
// change anytime vars
|
// change anytime vars
|
||||||
dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO);
|
dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO);
|
||||||
|
@ -423,8 +439,10 @@ void InitGame (void)
|
||||||
game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME);
|
game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME);
|
||||||
globals.num_edicts = game.maxclients+1;
|
globals.num_edicts = game.maxclients+1;
|
||||||
|
|
||||||
|
#ifndef DISABLE_FMOD
|
||||||
if(footstep_sounds->value)
|
if(footstep_sounds->value)
|
||||||
ReadTextureSurfaceAssignments();
|
ReadTextureSurfaceAssignments();
|
||||||
|
#endif
|
||||||
|
|
||||||
//CW++
|
//CW++
|
||||||
game.clock_count = 0;
|
game.clock_count = 0;
|
||||||
|
@ -434,11 +452,86 @@ void InitGame (void)
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *funcStr;
|
||||||
|
byte *funcPtr;
|
||||||
|
} functionList_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *mmoveStr;
|
||||||
|
mmove_t *mmovePtr;
|
||||||
|
} mmoveList_t;
|
||||||
|
|
||||||
|
#include "g_func_decs.h"
|
||||||
|
|
||||||
|
functionList_t functionList[] = {
|
||||||
|
#include "g_func_list.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "g_mmove_decs.h"
|
||||||
|
|
||||||
|
mmoveList_t mmoveList[] = {
|
||||||
|
#include "g_mmove_list.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
functionList_t *GetFunctionByAddress (byte *adr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; functionList[i].funcStr; i++)
|
||||||
|
{
|
||||||
|
if (functionList[i].funcPtr == adr)
|
||||||
|
return &functionList[i];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte *FindFunctionByName (char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; functionList[i].funcStr; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(name, functionList[i].funcStr))
|
||||||
|
return functionList[i].funcPtr;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mmoveList_t *GetMmoveByAddress (mmove_t *adr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; mmoveList[i].mmoveStr; i++)
|
||||||
|
{
|
||||||
|
if (mmoveList[i].mmovePtr == adr)
|
||||||
|
return &mmoveList[i];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mmove_t *FindMmoveByName (char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; mmoveList[i].mmoveStr; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(name, mmoveList[i].mmoveStr))
|
||||||
|
return mmoveList[i].mmovePtr;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
//=========================================================
|
||||||
|
|
||||||
void WriteField1 (FILE *f, field_t *field, byte *base)
|
void WriteField1 (FILE *f, field_t *field, byte *base)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
int len;
|
int len;
|
||||||
int index;
|
int index;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
functionList_t *func;
|
||||||
|
mmoveList_t *mmove;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (field->flags & FFL_SPAWNTEMP)
|
if (field->flags & FFL_SPAWNTEMP)
|
||||||
return;
|
return;
|
||||||
|
@ -482,7 +575,36 @@ void WriteField1 (FILE *f, field_t *field, byte *base)
|
||||||
index = *(gitem_t **)p - itemlist;
|
index = *(gitem_t **)p - itemlist;
|
||||||
*(int *)p = index;
|
*(int *)p = index;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
// Matches with an address in the function list, which is generated by extractfuncs.exe.
|
||||||
|
// Actual name of function is saved as a string, allowing version-independent savegames.
|
||||||
|
case F_FUNCTION:
|
||||||
|
if (*(byte **)p == NULL)
|
||||||
|
len = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
func = GetFunctionByAddress (*(byte **)p);
|
||||||
|
if (!func)
|
||||||
|
gi.error ("WriteField1: function not in list, can't save game");
|
||||||
|
len = strlen(func->funcStr)+1;
|
||||||
|
}
|
||||||
|
*(int *)p = len;
|
||||||
|
break;
|
||||||
|
// Matches with an address in the mmove list, which is generated by extractfuncs.exe.
|
||||||
|
// Actual name of mmove is saved as a string, allowing version-independent savegames.
|
||||||
|
case F_MMOVE:
|
||||||
|
if (*(byte **)p == NULL)
|
||||||
|
len = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mmove = GetMmoveByAddress (*(mmove_t **)p);
|
||||||
|
if (!mmove)
|
||||||
|
gi.error ("WriteField1: mmove not in list, can't save game");
|
||||||
|
len = strlen(mmove->mmoveStr)+1;
|
||||||
|
}
|
||||||
|
*(int *)p = len;
|
||||||
|
break;
|
||||||
|
#else // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
//relative to code segment
|
//relative to code segment
|
||||||
case F_FUNCTION:
|
case F_FUNCTION:
|
||||||
if (*(byte **)p == NULL)
|
if (*(byte **)p == NULL)
|
||||||
|
@ -500,7 +622,7 @@ void WriteField1 (FILE *f, field_t *field, byte *base)
|
||||||
index = *(byte **)p - (byte *)&mmove_reloc;
|
index = *(byte **)p - (byte *)&mmove_reloc;
|
||||||
*(int *)p = index;
|
*(int *)p = index;
|
||||||
break;
|
break;
|
||||||
|
#endif // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
default:
|
default:
|
||||||
gi.error ("WriteEdict: unknown field type");
|
gi.error ("WriteEdict: unknown field type");
|
||||||
}
|
}
|
||||||
|
@ -511,6 +633,10 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
void *p;
|
void *p;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
functionList_t *func;
|
||||||
|
mmoveList_t *mmove;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (field->flags & FFL_SPAWNTEMP)
|
if (field->flags & FFL_SPAWNTEMP)
|
||||||
return;
|
return;
|
||||||
|
@ -525,6 +651,28 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
|
||||||
fwrite (*(char **)p, len, 1, f);
|
fwrite (*(char **)p, len, 1, f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
case F_FUNCTION:
|
||||||
|
if ( *(byte **)p )
|
||||||
|
{
|
||||||
|
func = GetFunctionByAddress (*(byte **)p);
|
||||||
|
if (!func)
|
||||||
|
gi.error ("WriteField2: function not in list, can't save game");
|
||||||
|
len = strlen(func->funcStr)+1;
|
||||||
|
fwrite (func->funcStr, len, 1, f);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case F_MMOVE:
|
||||||
|
if ( *(byte **)p )
|
||||||
|
{
|
||||||
|
mmove = GetMmoveByAddress (*(mmove_t **)p);
|
||||||
|
if (!mmove)
|
||||||
|
gi.error ("WriteField2: mmove not in list, can't save game");
|
||||||
|
len = strlen(mmove->mmoveStr)+1;
|
||||||
|
fwrite (mmove->mmoveStr, len, 1, f);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +681,9 @@ void ReadField (FILE *f, field_t *field, byte *base)
|
||||||
void *p;
|
void *p;
|
||||||
int len;
|
int len;
|
||||||
int index;
|
int index;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
char funcStr[512];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (field->flags & FFL_SPAWNTEMP)
|
if (field->flags & FFL_SPAWNTEMP)
|
||||||
return;
|
return;
|
||||||
|
@ -578,7 +729,38 @@ void ReadField (FILE *f, field_t *field, byte *base)
|
||||||
else
|
else
|
||||||
*(gitem_t **)p = &itemlist[index];
|
*(gitem_t **)p = &itemlist[index];
|
||||||
break;
|
break;
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
// Matches with a string in the function list, which is generated by extractfuncs.exe.
|
||||||
|
// Actual address of function is loaded from list, allowing version-independent savegames.
|
||||||
|
case F_FUNCTION:
|
||||||
|
len = *(int *)p;
|
||||||
|
if (!len)
|
||||||
|
*(byte **)p = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (len > sizeof(funcStr))
|
||||||
|
gi.error ("ReadField: function name is longer than buffer (%i chars)", sizeof(funcStr));
|
||||||
|
fread (funcStr, len, 1, f);
|
||||||
|
if ( !(*(byte **)p = FindFunctionByName (funcStr)) )
|
||||||
|
gi.error ("ReadField: function %s not found in table, can't load game", funcStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// Matches with a string in the mmove list, which is generated by extractfuncs.exe.
|
||||||
|
// Actual address of mmove is loaded from list, allowing version-independent savegames.
|
||||||
|
case F_MMOVE:
|
||||||
|
len = *(int *)p;
|
||||||
|
if (!len)
|
||||||
|
*(byte **)p = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (len > sizeof(funcStr))
|
||||||
|
gi.error ("ReadField: mmove name is longer than buffer (%i chars)", sizeof(funcStr));
|
||||||
|
fread (funcStr, len, 1, f);
|
||||||
|
if ( !(*(mmove_t **)p = FindMmoveByName (funcStr)) )
|
||||||
|
gi.error ("ReadField: mmove %s not found in table, can't load game", funcStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#else // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
//relative to code segment
|
//relative to code segment
|
||||||
case F_FUNCTION:
|
case F_FUNCTION:
|
||||||
index = *(int *)p;
|
index = *(int *)p;
|
||||||
|
@ -596,7 +778,7 @@ void ReadField (FILE *f, field_t *field, byte *base)
|
||||||
else
|
else
|
||||||
*(byte **)p = (byte *)&mmove_reloc + index;
|
*(byte **)p = (byte *)&mmove_reloc + index;
|
||||||
break;
|
break;
|
||||||
|
#endif // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
default:
|
default:
|
||||||
gi.error ("ReadEdict: unknown field type");
|
gi.error ("ReadEdict: unknown field type");
|
||||||
}
|
}
|
||||||
|
@ -675,6 +857,9 @@ void WriteGame (char *filename, qboolean autosave)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
char str[16];
|
char str[16];
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
char str2[64];
|
||||||
|
#endif
|
||||||
|
|
||||||
if(developer->value)
|
if(developer->value)
|
||||||
gi.dprintf ("==== WriteGame ====\n");
|
gi.dprintf ("==== WriteGame ====\n");
|
||||||
|
@ -693,6 +878,16 @@ void WriteGame (char *filename, qboolean autosave)
|
||||||
strcpy (str, __DATE__);
|
strcpy (str, __DATE__);
|
||||||
fwrite (str, sizeof(str), 1, f);
|
fwrite (str, sizeof(str), 1, f);
|
||||||
|
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
// use modname and save version for compatibility instead of build date
|
||||||
|
memset (str2, 0, sizeof(str2));
|
||||||
|
strcpy (str2, SAVEGAME_DLLNAME);
|
||||||
|
fwrite (str2, sizeof(str2), 1, f);
|
||||||
|
|
||||||
|
i = SAVEGAME_VERSION;
|
||||||
|
fwrite (&i, sizeof(i), 1, f);
|
||||||
|
#endif
|
||||||
|
|
||||||
game.autosaved = autosave;
|
game.autosaved = autosave;
|
||||||
fwrite (&game, sizeof(game), 1, f);
|
fwrite (&game, sizeof(game), 1, f);
|
||||||
game.autosaved = false;
|
game.autosaved = false;
|
||||||
|
@ -708,6 +903,9 @@ void ReadGame (char *filename)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
char str[16];
|
char str[16];
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
char str2[64];
|
||||||
|
#endif
|
||||||
|
|
||||||
if(developer->value)
|
if(developer->value)
|
||||||
gi.dprintf ("==== ReadGame ====\n");
|
gi.dprintf ("==== ReadGame ====\n");
|
||||||
|
@ -719,11 +917,28 @@ void ReadGame (char *filename)
|
||||||
gi.error ("Couldn't open %s", filename);
|
gi.error ("Couldn't open %s", filename);
|
||||||
|
|
||||||
fread (str, sizeof(str), 1, f);
|
fread (str, sizeof(str), 1, f);
|
||||||
|
#ifndef SAVEGAME_USE_FUNCTION_TABLE
|
||||||
if (strcmp (str, __DATE__))
|
if (strcmp (str, __DATE__))
|
||||||
{
|
{
|
||||||
fclose (f);
|
fclose (f);
|
||||||
gi.error ("Savegame from an older version.\n");
|
gi.error ("Savegame from an older version.\n");
|
||||||
}
|
}
|
||||||
|
#else // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
// check modname and save version for compatibility instead of build date
|
||||||
|
fread (str2, sizeof(str2), 1, f);
|
||||||
|
if (strcmp (str2, SAVEGAME_DLLNAME))
|
||||||
|
{
|
||||||
|
fclose (f);
|
||||||
|
gi.error ("Savegame from a different game DLL.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fread (&i, sizeof(i), 1, f);
|
||||||
|
if (i != SAVEGAME_VERSION)
|
||||||
|
{
|
||||||
|
fclose (f);
|
||||||
|
gi.error ("ReadGame: savegame %s is wrong version (%i, should be %i)\n", filename, i, SAVEGAME_VERSION);
|
||||||
|
}
|
||||||
|
#endif // SAVEGAME_USE_FUNCTION_TABLE
|
||||||
|
|
||||||
g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
|
g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
|
||||||
globals.edicts = g_edicts;
|
globals.edicts = g_edicts;
|
||||||
|
@ -753,6 +968,16 @@ void WriteEdict (FILE *f, edict_t *ent)
|
||||||
// all of the ints, floats, and vectors stay as they are
|
// all of the ints, floats, and vectors stay as they are
|
||||||
temp = *ent;
|
temp = *ent;
|
||||||
|
|
||||||
|
#ifdef SAVEGAME_USE_FUNCTION_TABLE // FIXME: remove once this is working reliably
|
||||||
|
if (readout->value)
|
||||||
|
{
|
||||||
|
if (ent->classname && strlen(ent->classname))
|
||||||
|
gi.dprintf("WriteEdict: %s\n", ent->classname);
|
||||||
|
else
|
||||||
|
gi.dprintf("WriteEdict: unknown entity\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// change the pointers to lengths or indexes
|
// change the pointers to lengths or indexes
|
||||||
for (field=fields ; field->name ; field++)
|
for (field=fields ; field->name ; field++)
|
||||||
{
|
{
|
||||||
|
@ -812,6 +1037,7 @@ All pointer variables (except function pointers) must be handled specially.
|
||||||
void ReadEdict (FILE *f, edict_t *ent)
|
void ReadEdict (FILE *f, edict_t *ent)
|
||||||
{
|
{
|
||||||
field_t *field;
|
field_t *field;
|
||||||
|
int i; // Knightmare added
|
||||||
|
|
||||||
fread (ent, sizeof(*ent), 1, f);
|
fread (ent, sizeof(*ent), 1, f);
|
||||||
|
|
||||||
|
@ -819,6 +1045,9 @@ void ReadEdict (FILE *f, edict_t *ent)
|
||||||
{
|
{
|
||||||
ReadField (f, field, (byte *)ent);
|
ReadField (f, field, (byte *)ent);
|
||||||
}
|
}
|
||||||
|
// Knightmare- nullify reflection pointers to prevent crash
|
||||||
|
for (i=0; i<6; i++)
|
||||||
|
ent->reflection[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,37 @@
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
|
#ifdef DISABLE_FMOD
|
||||||
|
void PlayFootstep (edict_t *ent, footstep_t index) {}
|
||||||
|
void FootStep (edict_t *ent) {}
|
||||||
|
qboolean FMOD_Init ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void FMOD_Shutdown () {}
|
||||||
|
void FMOD_UpdateListenerPos () {}
|
||||||
|
void FMOD_UpdateSpeakerPos (edict_t *speaker) {}
|
||||||
|
void FMOD_Stop () {}
|
||||||
|
void CheckEndMusic (edict_t *ent) {}
|
||||||
|
void CheckEndSample (edict_t *ent) {}
|
||||||
|
int FMOD_PlaySound (edict_t *ent)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void FMOD_StopSound (edict_t *ent, qboolean free) {}
|
||||||
|
void target_playback_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point) {}
|
||||||
|
void target_playback_fadeout (edict_t *ent) {}
|
||||||
|
void target_playback_fadein (edict_t *ent) {}
|
||||||
|
qboolean FMOD_IsPlaying (edict_t *ent)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void Use_Target_Playback (edict_t *ent, edict_t *other, edict_t *activator) {}
|
||||||
|
void target_playback_delayed_start (edict_t *ent) {}
|
||||||
|
void target_playback_delayed_restart (edict_t *ent) {}
|
||||||
|
void SP_target_playback (edict_t *ent) {}
|
||||||
|
|
||||||
|
#else // DISABLE_FMOD
|
||||||
|
|
||||||
#include "fmod.h"
|
#include "fmod.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
@ -1396,3 +1429,4 @@ void SP_target_playback (edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DISABLE_FMOD
|
||||||
|
|
|
@ -689,7 +689,7 @@ void LoadTransitionEnts()
|
||||||
gi.dprintf("==== LoadTransitionEnts ====\n");
|
gi.dprintf("==== LoadTransitionEnts ====\n");
|
||||||
if(game.transition_ents)
|
if(game.transition_ents)
|
||||||
{
|
{
|
||||||
char t_file[_MAX_PATH];
|
char t_file[MAX_OSPATH];
|
||||||
int i, j;
|
int i, j;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
vec3_t v_spawn;
|
vec3_t v_spawn;
|
||||||
|
@ -1326,6 +1326,7 @@ void SP_worldspawn (edict_t *ent)
|
||||||
if(footstep_sounds->value)
|
if(footstep_sounds->value)
|
||||||
world->effects |= FX_WORLDSPAWN_STEPSOUNDS;
|
world->effects |= FX_WORLDSPAWN_STEPSOUNDS;
|
||||||
|
|
||||||
|
#ifndef DISABLE_FMOD
|
||||||
if(deathmatch->value || coop->value)
|
if(deathmatch->value || coop->value)
|
||||||
qFMOD_Footsteps = false;
|
qFMOD_Footsteps = false;
|
||||||
else if(world->effects & FX_WORLDSPAWN_STEPSOUNDS)
|
else if(world->effects & FX_WORLDSPAWN_STEPSOUNDS)
|
||||||
|
@ -1334,7 +1335,8 @@ void SP_worldspawn (edict_t *ent)
|
||||||
FMOD_Init();
|
FMOD_Init();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qFMOD_Footsteps = false;
|
qFMOD_Footsteps = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hud toggle ripped from TPP source
|
// Hud toggle ripped from TPP source
|
||||||
|
|
4496
src/g_target.bak
Normal file
4496
src/g_target.bak
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2160,17 +2160,27 @@ TE_FORCEWALL, 37 ??
|
||||||
*/
|
*/
|
||||||
void target_effect_at (edict_t *self, edict_t *activator)
|
void target_effect_at (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gi.WriteByte (svc_temp_entity);
|
gi.WriteByte (svc_temp_entity);
|
||||||
gi.WriteByte (self->style);
|
gi.WriteByte (self->style);
|
||||||
gi.WritePosition (self->s.origin);
|
gi.WritePosition (self->s.origin);
|
||||||
gi.WriteShort (self - g_edicts);
|
gi.WriteShort (self - g_edicts);
|
||||||
gi.multicast (self->s.origin, MULTICAST_PVS);
|
gi.multicast (self->s.origin, MULTICAST_PVS);
|
||||||
}
|
*/ }
|
||||||
/* Poor man's target_steam
|
/* Poor man's target_steam
|
||||||
TE_STEAM 40
|
TE_STEAM 40
|
||||||
*/
|
*/
|
||||||
void target_effect_steam (edict_t *self, edict_t *activator)
|
void target_effect_steam (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static int nextid;
|
static int nextid;
|
||||||
int wait;
|
int wait;
|
||||||
|
|
||||||
|
@ -2196,7 +2206,7 @@ void target_effect_steam (edict_t *self, edict_t *activator)
|
||||||
|
|
||||||
if (level.num_reflectors)
|
if (level.num_reflectors)
|
||||||
ReflectSteam (self->s.origin,self->movedir,self->count,self->sounds,(int)(self->speed),wait,nextid);
|
ReflectSteam (self->s.origin,self->movedir,self->count,self->sounds,(int)(self->speed),wait,nextid);
|
||||||
}
|
*/ }
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
/*
|
/*
|
||||||
|
@ -2210,6 +2220,11 @@ moving in (movedir) direction.
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
void target_effect_splash (edict_t *self, edict_t *activator)
|
void target_effect_splash (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gi.WriteByte(svc_temp_entity);
|
gi.WriteByte(svc_temp_entity);
|
||||||
gi.WriteByte(self->style);
|
gi.WriteByte(self->style);
|
||||||
gi.WriteByte(self->count);
|
gi.WriteByte(self->count);
|
||||||
|
@ -2217,7 +2232,7 @@ void target_effect_splash (edict_t *self, edict_t *activator)
|
||||||
gi.WriteDir(self->movedir);
|
gi.WriteDir(self->movedir);
|
||||||
gi.WriteByte(self->sounds);
|
gi.WriteByte(self->sounds);
|
||||||
gi.multicast(self->s.origin, MULTICAST_PVS);
|
gi.multicast(self->s.origin, MULTICAST_PVS);
|
||||||
}
|
*/ }
|
||||||
|
|
||||||
//======================================================
|
//======================================================
|
||||||
/*
|
/*
|
||||||
|
@ -2239,6 +2254,11 @@ in Potentially Visible Set from vector (origin)
|
||||||
//======================================================
|
//======================================================
|
||||||
void target_effect_trail (edict_t *self, edict_t *activator)
|
void target_effect_trail (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
edict_t *target;
|
edict_t *target;
|
||||||
|
|
||||||
if (!self->target) return;
|
if (!self->target) return;
|
||||||
|
@ -2265,13 +2285,18 @@ void target_effect_trail (edict_t *self, edict_t *activator)
|
||||||
(self->style == TE_BUBBLETRAIL2))
|
(self->style == TE_BUBBLETRAIL2))
|
||||||
ReflectTrail(self->style,self->s.origin,target->s.origin);
|
ReflectTrail(self->style,self->s.origin,target->s.origin);
|
||||||
}
|
}
|
||||||
}
|
*/ }
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
/* TE_LIGHTNING 33 Lightning bolt
|
/* TE_LIGHTNING 33 Lightning bolt
|
||||||
|
|
||||||
Similar but slightly different syntax to trail stuff */
|
Similar but slightly different syntax to trail stuff */
|
||||||
void target_effect_lightning(edict_t *self, edict_t *activator)
|
void target_effect_lightning(edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
edict_t *target;
|
edict_t *target;
|
||||||
|
|
||||||
if (!self->target) return;
|
if (!self->target) return;
|
||||||
|
@ -2285,7 +2310,7 @@ void target_effect_lightning(edict_t *self, edict_t *activator)
|
||||||
gi.WritePosition (target->s.origin);
|
gi.WritePosition (target->s.origin);
|
||||||
gi.WritePosition (self->s.origin);
|
gi.WritePosition (self->s.origin);
|
||||||
gi.multicast (self->s.origin, MULTICAST_PVS);
|
gi.multicast (self->s.origin, MULTICAST_PVS);
|
||||||
}
|
*/ }
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
/*
|
/*
|
||||||
Spawns sparks of (type) from (start) in direction of (movdir) and
|
Spawns sparks of (type) from (start) in direction of (movdir) and
|
||||||
|
@ -2312,6 +2337,11 @@ Broadcasts to all in Potentially Visible Set from vector (origin)
|
||||||
//======================================================
|
//======================================================
|
||||||
void target_effect_sparks (edict_t *self, edict_t *activator)
|
void target_effect_sparks (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gi.WriteByte(svc_temp_entity);
|
gi.WriteByte(svc_temp_entity);
|
||||||
gi.WriteByte(self->style);
|
gi.WriteByte(self->style);
|
||||||
gi.WritePosition(self->s.origin);
|
gi.WritePosition(self->s.origin);
|
||||||
|
@ -2321,7 +2351,7 @@ void target_effect_sparks (edict_t *self, edict_t *activator)
|
||||||
|
|
||||||
if (level.num_reflectors)
|
if (level.num_reflectors)
|
||||||
ReflectSparks(self->style,self->s.origin,self->movedir);
|
ReflectSparks(self->style,self->s.origin,self->movedir);
|
||||||
}
|
*/ }
|
||||||
|
|
||||||
//======================================================
|
//======================================================
|
||||||
/*
|
/*
|
||||||
|
@ -2350,6 +2380,11 @@ Potentially Hearable set from vector (origin)
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void target_effect_explosion (edict_t *self, edict_t *activator)
|
void target_effect_explosion (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gi.WriteByte(svc_temp_entity);
|
gi.WriteByte(svc_temp_entity);
|
||||||
gi.WriteByte(self->style);
|
gi.WriteByte(self->style);
|
||||||
gi.WritePosition(self->s.origin);
|
gi.WritePosition(self->s.origin);
|
||||||
|
@ -2358,7 +2393,7 @@ void target_effect_explosion (edict_t *self, edict_t *activator)
|
||||||
if (level.num_reflectors)
|
if (level.num_reflectors)
|
||||||
ReflectExplosion (self->style, self->s.origin);
|
ReflectExplosion (self->style, self->s.origin);
|
||||||
|
|
||||||
}
|
*/ }
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
/* TE_TUNNEL_SPARKS 29
|
/* TE_TUNNEL_SPARKS 29
|
||||||
Similar to other splash effects, but Xatrix does some funky things with
|
Similar to other splash effects, but Xatrix does some funky things with
|
||||||
|
@ -2366,6 +2401,11 @@ void target_effect_explosion (edict_t *self, edict_t *activator)
|
||||||
|
|
||||||
void target_effect_tunnel_sparks (edict_t *self, edict_t *activator)
|
void target_effect_tunnel_sparks (edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2381,22 +2421,32 @@ void target_effect_tunnel_sparks (edict_t *self, edict_t *activator)
|
||||||
gi.WriteByte (self->sounds + (rand()&7)); // color
|
gi.WriteByte (self->sounds + (rand()&7)); // color
|
||||||
gi.multicast (self->s.origin, MULTICAST_PVS);
|
gi.multicast (self->s.origin, MULTICAST_PVS);
|
||||||
}
|
}
|
||||||
}
|
*/ }
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
/* TE_WIDOWBEAMOUT 50
|
/* TE_WIDOWBEAMOUT 50
|
||||||
*/
|
*/
|
||||||
void target_effect_widowbeam(edict_t *self, edict_t *activator)
|
void target_effect_widowbeam(edict_t *self, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gi.WriteByte (svc_temp_entity);
|
gi.WriteByte (svc_temp_entity);
|
||||||
gi.WriteByte (TE_WIDOWBEAMOUT);
|
gi.WriteByte (TE_WIDOWBEAMOUT);
|
||||||
gi.WriteShort (20001);
|
gi.WriteShort (20001);
|
||||||
gi.WritePosition (self->s.origin);
|
gi.WritePosition (self->s.origin);
|
||||||
gi.multicast (self->s.origin, MULTICAST_PVS);
|
gi.multicast (self->s.origin, MULTICAST_PVS);
|
||||||
}
|
*/ }
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
|
|
||||||
void target_effect_use(edict_t *self, edict_t *other, edict_t *activator)
|
void target_effect_use(edict_t *self, edict_t *other, edict_t *activator)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !activator)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self->spawnflags & 1) {
|
if (self->spawnflags & 1) {
|
||||||
// currently looped on - turn it off
|
// currently looped on - turn it off
|
||||||
self->spawnflags &= ~1;
|
self->spawnflags &= ~1;
|
||||||
|
@ -2420,15 +2470,25 @@ void target_effect_use(edict_t *self, edict_t *other, edict_t *activator)
|
||||||
if (!VectorLength(mover->velocity)) return;
|
if (!VectorLength(mover->velocity)) return;
|
||||||
}
|
}
|
||||||
self->play(self,activator);
|
self->play(self,activator);
|
||||||
}
|
*/ }
|
||||||
void target_effect_think(edict_t *self)
|
void target_effect_think(edict_t *self)
|
||||||
{
|
{
|
||||||
|
/* if(!self || !self->play || !level.time || !self->wait)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self->play(self,NULL);
|
self->play(self,NULL);
|
||||||
self->nextthink = level.time + self->wait;
|
self->nextthink = level.time + self->wait;
|
||||||
}
|
*/ }
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
void SP_target_effect (edict_t *self)
|
void SP_target_effect (edict_t *self)
|
||||||
{
|
{
|
||||||
|
/* if(!self)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self->movewith)
|
if (self->movewith)
|
||||||
self->movetype = MOVETYPE_PUSH;
|
self->movetype = MOVETYPE_PUSH;
|
||||||
else
|
else
|
||||||
|
@ -2537,7 +2597,7 @@ void SP_target_effect (edict_t *self)
|
||||||
if (self->spawnflags & 1)
|
if (self->spawnflags & 1)
|
||||||
self->nextthink = level.time + 1;
|
self->nextthink = level.time + 1;
|
||||||
|
|
||||||
}
|
*/ }
|
||||||
|
|
||||||
/*=====================================================================================
|
/*=====================================================================================
|
||||||
TARGET_ATTRACTOR - pulls target entity towards its origin
|
TARGET_ATTRACTOR - pulls target entity towards its origin
|
||||||
|
@ -3585,7 +3645,7 @@ void use_target_failure (edict_t *self, edict_t *other, edict_t *activator)
|
||||||
gi.sound (activator, CHAN_VOICE|CHAN_RELIABLE, self->noise_index, 1, ATTN_NORM, 0);
|
gi.sound (activator, CHAN_VOICE|CHAN_RELIABLE, self->noise_index, 1, ATTN_NORM, 0);
|
||||||
|
|
||||||
self->target_ent = activator;
|
self->target_ent = activator;
|
||||||
if (stricmp(vid_ref->string,"gl"))
|
if (Q_stricmp(vid_ref->string,"gl"))
|
||||||
{
|
{
|
||||||
self->flags = 12;
|
self->flags = 12;
|
||||||
self->think = target_failure_fade_lights;
|
self->think = target_failure_fade_lights;
|
||||||
|
@ -4493,4 +4553,4 @@ void SP_target_viewshake(edict_t *self)
|
||||||
self->use = target_viewshake_use;
|
self->use = target_viewshake_use;
|
||||||
self->svflags |= SVF_NOCLIENT;
|
self->svflags |= SVF_NOCLIENT;
|
||||||
}
|
}
|
||||||
//CW--
|
//CW--
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <shlobj.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TRIGGER_MONSTER 1
|
#define TRIGGER_MONSTER 1
|
||||||
#define TRIGGER_NOT_PLAYER 2
|
#define TRIGGER_NOT_PLAYER 2
|
||||||
#define TRIGGER_START_OFF 4
|
#define TRIGGER_START_OFF 4
|
||||||
|
@ -1102,7 +1107,7 @@ void trigger_inside_think (edict_t *self)
|
||||||
hit = touch[i];
|
hit = touch[i];
|
||||||
if (!hit->inuse) continue;
|
if (!hit->inuse) continue;
|
||||||
if (!hit->targetname) continue;
|
if (!hit->targetname) continue;
|
||||||
if (stricmp(self->pathtarget, hit->targetname)) continue;
|
if (Q_stricmp(self->pathtarget, hit->targetname)) continue;
|
||||||
// must be COMPLETELY inside
|
// must be COMPLETELY inside
|
||||||
if (hit->absmin[0] < self->absmin[0]) continue;
|
if (hit->absmin[0] < self->absmin[0]) continue;
|
||||||
if (hit->absmin[1] < self->absmin[1]) continue;
|
if (hit->absmin[1] < self->absmin[1]) continue;
|
||||||
|
@ -1794,12 +1799,96 @@ entlist_t DoNotMove[] = {
|
||||||
|
|
||||||
void trans_ent_filename (char *filename)
|
void trans_ent_filename (char *filename)
|
||||||
{
|
{
|
||||||
GameDirRelativePath("save/trans.ent",filename);
|
char *gamedirname = "";
|
||||||
|
char *cfgdir;
|
||||||
|
char *savedirfilename = "save/trans.ent";
|
||||||
|
|
||||||
|
cvar_t *gamedircvar = gi.cvar("gamedir", "", 0);
|
||||||
|
if(strlen(gamedircvar->string))
|
||||||
|
{
|
||||||
|
gamedirname = strcat(gamedircvar->string, "/");
|
||||||
|
}
|
||||||
|
#ifdef _WIN32
|
||||||
|
char *cur;
|
||||||
|
char *old;
|
||||||
|
char profile[MAX_PATH];
|
||||||
|
int len;
|
||||||
|
wchar_t sprofile[MAX_PATH];
|
||||||
|
wchar_t uprofile[MAX_PATH];
|
||||||
|
cfgdir = "YamagiQ2";
|
||||||
|
|
||||||
|
/* The following lines implement a horrible
|
||||||
|
hack to connect the UTF-16 WinAPI to the
|
||||||
|
ASCII Quake II. While this should work in
|
||||||
|
most cases, it'll fail if the "Windows to
|
||||||
|
DOS filename translation" is switched off.
|
||||||
|
In that case the function will return NULL
|
||||||
|
and no homedir is used. */
|
||||||
|
|
||||||
|
/* Get the path to "My Documents" directory */
|
||||||
|
SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, uprofile);
|
||||||
|
|
||||||
|
/* Create a UTF-16 DOS path */
|
||||||
|
len = GetShortPathNameW(uprofile, sprofile, sizeof(sprofile));
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
GameDirRelativePath(savedirfilename,filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Since the DOS path contains no UTF-16 characters, just convert it to ASCII */
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, sprofile, -1, profile, sizeof(profile), NULL, NULL);
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
GameDirRelativePath(savedirfilename,filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if path is too long */
|
||||||
|
if (len + 11 >= 256)
|
||||||
|
{
|
||||||
|
GameDirRelativePath(savedirfilename,filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace backslashes by slashes */
|
||||||
|
cur = old = profile;
|
||||||
|
|
||||||
|
if (strstr(cur, "\\") != NULL)
|
||||||
|
{
|
||||||
|
while (cur != NULL)
|
||||||
|
{
|
||||||
|
if ((cur - old) > 1)
|
||||||
|
{
|
||||||
|
*cur = '/';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
old = cur;
|
||||||
|
cur = strchr(old + 1, '\\');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char *profile;
|
||||||
|
cfgdir = ".yq2";
|
||||||
|
|
||||||
|
profile = getenv("HOME");
|
||||||
|
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
GameDirRelativePath(savedirfilename,filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sprintf(filename, "%s/%s/%s%s", profile, cfgdir, gamedirname, savedirfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
int trigger_transition_ents (edict_t *changelevel, edict_t *self)
|
int trigger_transition_ents (edict_t *changelevel, edict_t *self)
|
||||||
{
|
{
|
||||||
char t_file[_MAX_PATH];
|
char t_file[MAX_OSPATH];
|
||||||
int i, j;
|
int i, j;
|
||||||
int total=0;
|
int total=0;
|
||||||
qboolean nogo;
|
qboolean nogo;
|
||||||
|
|
|
@ -10,7 +10,7 @@ a non-instant attack weapon. It checks to see if a
|
||||||
monster's dodge function should be called.
|
monster's dodge function should be called.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed)
|
/*static*/ void check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
vec3_t v;
|
vec3_t v;
|
||||||
|
@ -35,7 +35,7 @@ static void check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CW++ Infantry guards can roll-dodge MG bursts
|
//CW++ Infantry guards can roll-dodge MG bursts
|
||||||
static void check_dodge_inf_mg(edict_t *self, vec3_t start, vec3_t dir)
|
/*static*/ void check_dodge_inf_mg(edict_t *self, vec3_t start, vec3_t dir)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
|
@ -154,7 +154,7 @@ fire_lead
|
||||||
This is an internal support routine used for bullet/pellet based weapons.
|
This is an internal support routine used for bullet/pellet based weapons.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void fire_lead (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int te_impact, int hspread, int vspread, int mod)
|
/*static*/ void fire_lead (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int te_impact, int hspread, int vspread, int mod)
|
||||||
{
|
{
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
|
@ -676,7 +676,7 @@ void Grenade_Evade (edict_t *monster)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Grenade_Add_To_Chain (edict_t *grenade)
|
/*static*/ void Grenade_Add_To_Chain (edict_t *grenade)
|
||||||
{
|
{
|
||||||
edict_t *ancestor;
|
edict_t *ancestor;
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ static void Grenade_Add_To_Chain (edict_t *grenade)
|
||||||
grenade->prev_grenade = ancestor;
|
grenade->prev_grenade = ancestor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Grenade_Remove_From_Chain (edict_t *grenade)
|
/*static*/ void Grenade_Remove_From_Chain (edict_t *grenade)
|
||||||
{
|
{
|
||||||
if (grenade->prev_grenade)
|
if (grenade->prev_grenade)
|
||||||
{
|
{
|
||||||
|
@ -699,7 +699,7 @@ static void Grenade_Remove_From_Chain (edict_t *grenade)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Grenade_Explode (edict_t *ent)
|
/*static*/ void Grenade_Explode (edict_t *ent)
|
||||||
{
|
{
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
int mod;
|
int mod;
|
||||||
|
@ -763,7 +763,7 @@ static void Grenade_Explode (edict_t *ent)
|
||||||
G_FreeEdict (ent);
|
G_FreeEdict (ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Grenade_Touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
|
/*static*/ void Grenade_Touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
|
||||||
{
|
{
|
||||||
if (other == ent->owner)
|
if (other == ent->owner)
|
||||||
return;
|
return;
|
||||||
|
@ -1205,7 +1205,7 @@ void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *su
|
||||||
G_FreeEdict (ent);
|
G_FreeEdict (ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rocket_explode (edict_t *ent)
|
/*static*/ void rocket_explode (edict_t *ent)
|
||||||
{
|
{
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
int type;
|
int type;
|
||||||
|
@ -1232,7 +1232,7 @@ static void rocket_explode (edict_t *ent)
|
||||||
|
|
||||||
G_FreeEdict (ent);
|
G_FreeEdict (ent);
|
||||||
}
|
}
|
||||||
static void rocket_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
|
/*static*/ void rocket_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
|
||||||
{
|
{
|
||||||
self->takedamage = DAMAGE_NO;
|
self->takedamage = DAMAGE_NO;
|
||||||
self->nextthink = level.time + FRAMETIME;
|
self->nextthink = level.time + FRAMETIME;
|
||||||
|
|
|
@ -1768,7 +1768,7 @@ qboolean InPak(char *basedir, char *gamedir, char *filename)
|
||||||
for(kk=0; kk<numitems && !found; kk++)
|
for(kk=0; kk<numitems && !found; kk++)
|
||||||
{
|
{
|
||||||
fread(&pakitem,1,sizeof(pak_item_t),f);
|
fread(&pakitem,1,sizeof(pak_item_t),f);
|
||||||
if(!stricmp(pakitem.name,filename))
|
if(!Q_stricmp(pakitem.name,filename))
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ void SP_misc_teleporter_dest (edict_t *ent);
|
||||||
// we use carnal knowledge of the maps to fix the coop spot targetnames to match
|
// we use carnal knowledge of the maps to fix the coop spot targetnames to match
|
||||||
// that of the nearest named single player spot
|
// that of the nearest named single player spot
|
||||||
|
|
||||||
static void SP_FixCoopSpots (edict_t *self)
|
/*static*/ void SP_FixCoopSpots (edict_t *self)
|
||||||
{
|
{
|
||||||
edict_t *spot;
|
edict_t *spot;
|
||||||
vec3_t d;
|
vec3_t d;
|
||||||
|
@ -51,7 +51,7 @@ static void SP_FixCoopSpots (edict_t *self)
|
||||||
// some maps don't have any coop spots at all, so we need to create them
|
// some maps don't have any coop spots at all, so we need to create them
|
||||||
// where they should have been
|
// where they should have been
|
||||||
|
|
||||||
static void SP_CreateCoopSpots (edict_t *self)
|
/*static*/ void SP_CreateCoopSpots (edict_t *self)
|
||||||
{
|
{
|
||||||
edict_t *spot;
|
edict_t *spot;
|
||||||
|
|
||||||
|
@ -513,6 +513,7 @@ void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
|
||||||
|
|
||||||
self->client->pers.spawn_landmark = false; // paranoia check
|
self->client->pers.spawn_landmark = false; // paranoia check
|
||||||
self->client->pers.spawn_levelchange = false;
|
self->client->pers.spawn_levelchange = false;
|
||||||
|
SetLazarusCrosshair(self); //backup crosshair
|
||||||
self->client->zooming = 0;
|
self->client->zooming = 0;
|
||||||
self->client->zoomed = false;
|
self->client->zoomed = false;
|
||||||
SetSensitivities(self,true);
|
SetSensitivities(self,true);
|
||||||
|
@ -1647,6 +1648,7 @@ void ClientBegin (edict_t *ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DWH
|
// DWH
|
||||||
|
SetLazarusCrosshair(ent); //backup crosshair
|
||||||
SetSensitivities(ent,true);
|
SetSensitivities(ent,true);
|
||||||
|
|
||||||
if (game.maxclients == 1)
|
if (game.maxclients == 1)
|
||||||
|
@ -2417,13 +2419,13 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
|
||||||
viewing = LookingAt(ent,0,intersect,&range);
|
viewing = LookingAt(ent,0,intersect,&range);
|
||||||
if(viewing && viewing->classname)
|
if(viewing && viewing->classname)
|
||||||
{
|
{
|
||||||
if(!stricmp(viewing->classname,"crane_control"))
|
if(!Q_stricmp(viewing->classname,"crane_control"))
|
||||||
crane_control_action(viewing,ent,intersect);
|
crane_control_action(viewing,ent,intersect);
|
||||||
if(!stricmp(viewing->classname,"target_lock_digit"))
|
if(!Q_stricmp(viewing->classname,"target_lock_digit"))
|
||||||
lock_digit_increment(viewing,ent);
|
lock_digit_increment(viewing,ent);
|
||||||
if(!stricmp(viewing->classname,"func_trainbutton") && (viewing->spawnflags & 1))
|
if(!Q_stricmp(viewing->classname,"func_trainbutton") && (viewing->spawnflags & 1))
|
||||||
trainbutton_use(viewing,ent,ent);
|
trainbutton_use(viewing,ent,ent);
|
||||||
if(!stricmp(viewing->classname,"func_monitor") && range <= 100) {
|
if(!Q_stricmp(viewing->classname,"func_monitor") && range <= 100) {
|
||||||
use_camera(viewing,ent,ent);
|
use_camera(viewing,ent,ent);
|
||||||
if(client->spycam && client->spycam->viewer == ent) {
|
if(client->spycam && client->spycam->viewer == ent) {
|
||||||
client->old_owner_angles[0] = ucmd->angles[0];
|
client->old_owner_angles[0] = ucmd->angles[0];
|
||||||
|
|
26
src/p_text.c
26
src/p_text.c
|
@ -242,14 +242,14 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
strcpy(filename,basedir->string);
|
strcpy(filename,basedir->string);
|
||||||
if(strlen(gamedir->string))
|
if(strlen(gamedir->string))
|
||||||
{
|
{
|
||||||
strcat(filename,"\\");
|
strcat(filename,"/");
|
||||||
strcat(filename,gamedir->string);
|
strcat(filename,gamedir->string);
|
||||||
}
|
}
|
||||||
// First check for existence of text file in pak0.pak -> pak9.pak
|
// First check for existence of text file in pak0.pak -> pak9.pak
|
||||||
in_pak = false;
|
in_pak = false;
|
||||||
for(i=0; i<=9 && !in_pak; i++)
|
for(i=0; i<=9 && !in_pak; i++)
|
||||||
{
|
{
|
||||||
sprintf(pakfile,"%s\\pak%d.pak",filename,i);
|
sprintf(pakfile,"%s/pak%d.pak",filename,i);
|
||||||
if (NULL != (f = fopen(pakfile, "rb")))
|
if (NULL != (f = fopen(pakfile, "rb")))
|
||||||
{
|
{
|
||||||
num=fread(&pakheader,1,sizeof(pak_header_t),f);
|
num=fread(&pakheader,1,sizeof(pak_header_t),f);
|
||||||
|
@ -266,7 +266,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
for(k=0; k<numitems && !in_pak; k++)
|
for(k=0; k<numitems && !in_pak; k++)
|
||||||
{
|
{
|
||||||
fread(&pakitem,1,sizeof(pak_item_t),f);
|
fread(&pakitem,1,sizeof(pak_item_t),f);
|
||||||
if(!stricmp(pakitem.name,textname))
|
if(!Q_stricmp(pakitem.name,textname))
|
||||||
{
|
{
|
||||||
in_pak = true;
|
in_pak = true;
|
||||||
fseek(f,pakitem.start,SEEK_SET);
|
fseek(f,pakitem.start,SEEK_SET);
|
||||||
|
@ -291,7 +291,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
}
|
}
|
||||||
if(!in_pak)
|
if(!in_pak)
|
||||||
{
|
{
|
||||||
strcat(filename,"\\maps\\");
|
strcat(filename,"/maps/");
|
||||||
strcat(filename,message);
|
strcat(filename,message);
|
||||||
f = fopen(filename,"rb");
|
f = fopen(filename,"rb");
|
||||||
if(!f)
|
if(!f)
|
||||||
|
@ -441,7 +441,9 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
}
|
}
|
||||||
memset(hnd->buffer,0,hnd->allocated);
|
memset(hnd->buffer,0,hnd->allocated);
|
||||||
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
||||||
p1 = hnd->buffer + (p2-temp_buffer);
|
|
||||||
|
char *force_char_cast = temp_buffer;
|
||||||
|
p1 = hnd->buffer + (p2-force_char_cast);
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
free(temp_buffer);
|
free(temp_buffer);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +480,10 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
memset(hnd->buffer,0,hnd->allocated);
|
memset(hnd->buffer,0,hnd->allocated);
|
||||||
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
p1 = hnd->buffer + (p2-temp_buffer);
|
|
||||||
|
char *force_char_cast = temp_buffer;
|
||||||
|
|
||||||
|
p1 = hnd->buffer + (p2-force_char_cast);
|
||||||
free(temp_buffer);
|
free(temp_buffer);
|
||||||
}
|
}
|
||||||
p2 = hnd->buffer + hnd->size;
|
p2 = hnd->buffer + hnd->size;
|
||||||
|
@ -508,7 +513,10 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
memset(hnd->buffer,0,hnd->allocated);
|
memset(hnd->buffer,0,hnd->allocated);
|
||||||
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
memcpy(hnd->buffer,temp_buffer,hnd->size);
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
p1 = hnd->buffer + (p2-temp_buffer);
|
|
||||||
|
char *force_char_cast = temp_buffer;
|
||||||
|
|
||||||
|
p1 = hnd->buffer + (p2-force_char_cast);
|
||||||
free(temp_buffer);
|
free(temp_buffer);
|
||||||
}
|
}
|
||||||
p2 = hnd->buffer + hnd->size;
|
p2 = hnd->buffer + hnd->size;
|
||||||
|
@ -592,7 +600,9 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
|
||||||
while(*p2 != 0)
|
while(*p2 != 0)
|
||||||
p2++;
|
p2++;
|
||||||
p2++;
|
p2++;
|
||||||
memcpy(p1,p2,hnd->buffer+hnd->size-p2+1);
|
|
||||||
|
char *force_char_cast = hnd->buffer+hnd->size;
|
||||||
|
memcpy(p1,p2,force_char_cast-p2+1);
|
||||||
hnd->nlines--;
|
hnd->nlines--;
|
||||||
// Found one (only one is allowed)
|
// Found one (only one is allowed)
|
||||||
gi.sound (activator, CHAN_AUTO, gi.soundindex (sound), 1, ATTN_NORM, 0);
|
gi.sound (activator, CHAN_AUTO, gi.soundindex (sound), 1, ATTN_NORM, 0);
|
||||||
|
|
|
@ -528,7 +528,7 @@ void SV_CalcBlend (edict_t *ent)
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
||||||
// Turn off fade for dead software players or they won't see menu
|
// Turn off fade for dead software players or they won't see menu
|
||||||
if((ent->health <= 0) && (stricmp(vid_ref->string,"gl")))
|
if((ent->health <= 0) && (Q_stricmp(vid_ref->string,"gl")))
|
||||||
ent->client->fadein = 0;
|
ent->client->fadein = 0;
|
||||||
|
|
||||||
if(ent->client->fadein > level.framenum)
|
if(ent->client->fadein > level.framenum)
|
||||||
|
@ -1073,6 +1073,7 @@ void G_SetClientEvent (edict_t *ent)
|
||||||
int r;
|
int r;
|
||||||
r = rand() & 1 + ent->client->leftfoot*2;
|
r = rand() & 1 + ent->client->leftfoot*2;
|
||||||
ent->client->leftfoot = 1 - ent->client->leftfoot;
|
ent->client->leftfoot = 1 - ent->client->leftfoot;
|
||||||
|
#ifndef DISABLE_FMOD
|
||||||
if(qFMOD_Footsteps)
|
if(qFMOD_Footsteps)
|
||||||
{
|
{
|
||||||
switch (r){
|
switch (r){
|
||||||
|
@ -1084,13 +1085,16 @@ void G_SetClientEvent (edict_t *ent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
switch (r){
|
switch (r){
|
||||||
case 0: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder1.wav"),1.0,ATTN_NORM,0); break;
|
case 0: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder1.wav"),1.0,ATTN_NORM,0); break;
|
||||||
case 1: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder3.wav"),1.0,ATTN_NORM,0); break;
|
case 1: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder3.wav"),1.0,ATTN_NORM,0); break;
|
||||||
case 2: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder2.wav"),1.0,ATTN_NORM,0); break;
|
case 2: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder2.wav"),1.0,ATTN_NORM,0); break;
|
||||||
case 3: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder4.wav"),1.0,ATTN_NORM,0); break;
|
case 3: gi.sound(ent,CHAN_VOICE,gi.soundindex("player/pl_ladder4.wav"),1.0,ATTN_NORM,0); break;
|
||||||
}
|
}
|
||||||
|
#ifndef DISABLE_FMOD
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ vec3_t vec3_origin = {0,0,0};
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define GCC_COMP
|
||||||
#pragma optimize( "", off )
|
#pragma optimize( "", off )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -240,7 +241,7 @@ float Q_fabs (float f)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined _M_IX86 && !defined C_ONLY
|
#if defined _M_IX86 && !defined GCC_COMP
|
||||||
#pragma warning (disable:4035)
|
#pragma warning (disable:4035)
|
||||||
__declspec( naked ) long Q_ftol( float f )
|
__declspec( naked ) long Q_ftol( float f )
|
||||||
{
|
{
|
||||||
|
@ -324,7 +325,8 @@ BoxOnPlaneSide
|
||||||
Returns 1, 2, or 1 + 2
|
Returns 1, 2, or 1 + 2
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
#if !id386 || defined __linux__
|
|
||||||
|
#if !id386 || !defined _WIN32 || defined GCC_COMP
|
||||||
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
||||||
{
|
{
|
||||||
float dist1, dist2;
|
float dist1, dist2;
|
||||||
|
|
429
src/removed/g_splinetrain.c
Normal file
429
src/removed/g_splinetrain.c
Normal file
|
@ -0,0 +1,429 @@
|
||||||
|
#include "g_local.h"
|
||||||
|
|
||||||
|
#define STATE_TOP 0
|
||||||
|
#define STATE_BOTTOM 1
|
||||||
|
#define STATE_UP 2
|
||||||
|
#define STATE_DOWN 3
|
||||||
|
|
||||||
|
void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*));
|
||||||
|
void train_blocked (edict_t *self, edict_t *other);
|
||||||
|
void train_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
||||||
|
|
||||||
|
void train_spline_calc (edict_t *train, vec3_t p1, vec3_t p2, vec3_t a1, vec3_t a2, float m)
|
||||||
|
{
|
||||||
|
/* p1, p2 = origins of path_* ents
|
||||||
|
a1, a2 = angles from path_* ents
|
||||||
|
m = decimal position along curve */
|
||||||
|
|
||||||
|
vec3_t v1, v2; // direction vectors
|
||||||
|
vec3_t c1, c2; // control-point coords
|
||||||
|
vec3_t d, v; // temps
|
||||||
|
float s; // vector scale
|
||||||
|
vec3_t p, a; // final computed position & angles for mover
|
||||||
|
// these greatly simplify/speed up equations
|
||||||
|
// (make sure m is already assigned a value)
|
||||||
|
float n = 1.0 - m;
|
||||||
|
float m2 = m * m;
|
||||||
|
float m3 = m2 * m;
|
||||||
|
float n2 = n * n;
|
||||||
|
float n3 = n2 * n;
|
||||||
|
float mn2_3 = m * n2 * 3;
|
||||||
|
float m2n_3 = m2 * n * 3;
|
||||||
|
float mn_2 = m * n * 2;
|
||||||
|
|
||||||
|
// Beziers need two control-points to define the shape of the curve.
|
||||||
|
// These can be created from the available data. They are offset a
|
||||||
|
// specific distance from the endpoints (path_*s), in the direction
|
||||||
|
// of the endpoints' angle vectors (the 2nd control-point is offset in
|
||||||
|
// the opposite direction). The distance used is a fraction of the total
|
||||||
|
// distance between the endpoints, ensuring it's scaled proportionally.
|
||||||
|
// The factor of 0.4 is simply based on experimentation, as a value that
|
||||||
|
// yields nice even curves.
|
||||||
|
|
||||||
|
AngleVectors(a1, v1, NULL, NULL);
|
||||||
|
AngleVectors(a2, v2, NULL, NULL);
|
||||||
|
|
||||||
|
VectorSubtract(p2, p1, d);
|
||||||
|
s = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]) * 0.4;
|
||||||
|
|
||||||
|
VectorMA(p1, s, v1, c1);
|
||||||
|
VectorMA(p2, -s, v2, c2);
|
||||||
|
|
||||||
|
// cubic interpolation of the four points
|
||||||
|
// gives the position along the curve
|
||||||
|
p[0] = n3 * p1[0] + mn2_3 * c1[0] + m2n_3 * c2[0] + m3 * p2[0];
|
||||||
|
p[1] = n3 * p1[1] + mn2_3 * c1[1] + m2n_3 * c2[1] + m3 * p2[1];
|
||||||
|
p[2] = n3 * p1[2] + mn2_3 * c1[2] + m2n_3 * c2[2] + m3 * p2[2];
|
||||||
|
|
||||||
|
// should be optional:
|
||||||
|
// first derivative of bezier formula provides direction vector
|
||||||
|
// along the curve (equation simplified in terms of m & n)
|
||||||
|
v[0] = (n2 * p1[0] - (n2 - mn_2) * c1[0] - (mn_2 - m2) * c2[0] - m2 * p2[0]) / -s;
|
||||||
|
v[1] = (n2 * p1[1] - (n2 - mn_2) * c1[1] - (mn_2 - m2) * c2[1] - m2 * p2[1]) / -s;
|
||||||
|
v[2] = (n2 * p1[2] - (n2 - mn_2) * c1[2] - (mn_2 - m2) * c2[2] - m2 * p2[2]) / -s;
|
||||||
|
vectoangles(v, a);
|
||||||
|
|
||||||
|
VectorSubtract(p,train->mins,train->s.origin);
|
||||||
|
VectorCopy(a,train->s.angles);
|
||||||
|
|
||||||
|
gi.linkentity(train);
|
||||||
|
}
|
||||||
|
void train_spline_next (edict_t *self);
|
||||||
|
void train_spline_wait (edict_t *self)
|
||||||
|
{
|
||||||
|
if (self->target_ent->pathtarget)
|
||||||
|
{
|
||||||
|
char *savetarget;
|
||||||
|
edict_t *ent;
|
||||||
|
|
||||||
|
ent = self->target_ent;
|
||||||
|
savetarget = ent->target;
|
||||||
|
ent->target = ent->pathtarget;
|
||||||
|
G_UseTargets (ent, self->activator);
|
||||||
|
ent->target = savetarget;
|
||||||
|
|
||||||
|
// make sure we didn't get killed by a killtarget
|
||||||
|
if (!self->inuse)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lazarus: rotating trains
|
||||||
|
if(self->target_ent) {
|
||||||
|
if(self->target_ent->speed) {
|
||||||
|
self->speed = self->target_ent->speed;
|
||||||
|
self->moveinfo.speed = self->speed;
|
||||||
|
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
|
||||||
|
}
|
||||||
|
if(self->spawnflags & TRAIN_ROTATE) {
|
||||||
|
if(self->target_ent->pitch_speed)
|
||||||
|
self->pitch_speed = self->target_ent->pitch_speed;
|
||||||
|
if(self->target_ent->yaw_speed)
|
||||||
|
self->yaw_speed = self->target_ent->yaw_speed;
|
||||||
|
if(self->target_ent->roll_speed)
|
||||||
|
self->roll_speed = self->target_ent->roll_speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->moveinfo.wait)
|
||||||
|
{
|
||||||
|
if (self->moveinfo.wait > 0)
|
||||||
|
{
|
||||||
|
// Lazarus: turn off animation for stationary trains
|
||||||
|
self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST);
|
||||||
|
self->nextthink = level.time + self->moveinfo.wait;
|
||||||
|
self->think = train_spline_next;
|
||||||
|
}
|
||||||
|
else if (self->spawnflags & TRAIN_TOGGLE) // && wait < 0
|
||||||
|
{
|
||||||
|
train_spline_next (self);
|
||||||
|
self->spawnflags &= ~TRAIN_START_ON;
|
||||||
|
VectorClear (self->velocity);
|
||||||
|
// Lazarus: turn off animation for stationary trains
|
||||||
|
self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST);
|
||||||
|
self->nextthink = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(self->flags & FL_TEAMSLAVE))
|
||||||
|
{
|
||||||
|
if (self->s.sound && self->moveinfo.sound_end)
|
||||||
|
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0);
|
||||||
|
self->s.sound = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
train_spline_next (self);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void train_spline_move (edict_t *self)
|
||||||
|
{
|
||||||
|
edict_t *train;
|
||||||
|
|
||||||
|
train = self->enemy;
|
||||||
|
if(!train || !train->inuse)
|
||||||
|
return;
|
||||||
|
if(train->from != train->to)
|
||||||
|
{
|
||||||
|
train_spline_calc (train, train->from->s.origin, train->to->s.origin,
|
||||||
|
train->from->s.angles, train->to->s.angles,
|
||||||
|
train->moveinfo.ratio);
|
||||||
|
train->moveinfo.ratio += train->moveinfo.speed * FRAMETIME / train->moveinfo.distance;
|
||||||
|
}
|
||||||
|
self->nextthink = level.time + FRAMETIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
void train_spline_next (edict_t *self)
|
||||||
|
{
|
||||||
|
edict_t *ent;
|
||||||
|
vec3_t dest;
|
||||||
|
qboolean first;
|
||||||
|
vec3_t angles,v;
|
||||||
|
|
||||||
|
first = true;
|
||||||
|
again:
|
||||||
|
if (!self->target)
|
||||||
|
{
|
||||||
|
self->s.sound = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = G_PickTarget (self->target);
|
||||||
|
if (!ent)
|
||||||
|
{
|
||||||
|
gi.dprintf ("train_spline_next: bad target %s\n", self->target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// spline stuff:
|
||||||
|
self->from = self->to;
|
||||||
|
self->to = ent;
|
||||||
|
VectorSubtract(self->from->s.origin,self->to->s.origin,v);
|
||||||
|
self->moveinfo.distance = VectorLength(v);
|
||||||
|
self->moveinfo.ratio = 0.0;
|
||||||
|
// end spline stuff
|
||||||
|
self->target = ent->target;
|
||||||
|
|
||||||
|
// check for a teleport path_corner
|
||||||
|
if (ent->spawnflags & 1)
|
||||||
|
{
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
|
gi.dprintf ("connected teleport path_corners, see %s at %s\n", ent->classname, vtos(ent->s.origin));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
VectorSubtract (ent->s.origin, self->mins, self->s.origin);
|
||||||
|
VectorCopy (self->s.origin, self->s.old_origin);
|
||||||
|
self->s.event = EV_OTHER_TELEPORT;
|
||||||
|
gi.linkentity (self);
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
|
||||||
|
self->moveinfo.wait = ent->wait;
|
||||||
|
self->target_ent = ent;
|
||||||
|
|
||||||
|
if (!(self->flags & FL_TEAMSLAVE))
|
||||||
|
{
|
||||||
|
if (self->moveinfo.sound_start)
|
||||||
|
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
|
||||||
|
self->s.sound = self->moveinfo.sound_middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorSubtract (ent->s.origin, self->mins, dest);
|
||||||
|
self->moveinfo.state = STATE_TOP;
|
||||||
|
VectorCopy (self->s.origin, self->moveinfo.start_origin);
|
||||||
|
VectorCopy (dest, self->moveinfo.end_origin);
|
||||||
|
|
||||||
|
// Rroff rotating
|
||||||
|
if (self->spawnflags & TRAIN_ROTATE && !(ent->spawnflags & 2))
|
||||||
|
{
|
||||||
|
// Lazarus: No no no :-). This is measuring from the center
|
||||||
|
// of the func_train to the path_corner. Should
|
||||||
|
// be path_corner to path_corner.
|
||||||
|
//VectorSubtract (ent->s.origin, self->s.origin, v);
|
||||||
|
VectorAdd(self->s.origin,self->mins,v);
|
||||||
|
VectorSubtract(ent->s.origin,v,v);
|
||||||
|
vectoangles(v,angles);
|
||||||
|
self->ideal_yaw = angles[YAW];
|
||||||
|
self->ideal_pitch = angles[PITCH];
|
||||||
|
if(self->ideal_pitch < 0) self->ideal_pitch += 360;
|
||||||
|
self->ideal_roll = ent->roll;
|
||||||
|
|
||||||
|
VectorClear(self->movedir);
|
||||||
|
self->movedir[1] = 1.0;
|
||||||
|
}
|
||||||
|
Move_Calc (self, dest, train_spline_wait);
|
||||||
|
self->spawnflags |= TRAIN_START_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
void train_spline_resume (edict_t *self)
|
||||||
|
{
|
||||||
|
edict_t *ent;
|
||||||
|
vec3_t dest;
|
||||||
|
|
||||||
|
ent = self->target_ent;
|
||||||
|
|
||||||
|
VectorSubtract (ent->s.origin, self->mins, dest);
|
||||||
|
self->moveinfo.state = STATE_TOP;
|
||||||
|
VectorCopy (self->s.origin, self->moveinfo.start_origin);
|
||||||
|
VectorCopy (dest, self->moveinfo.end_origin);
|
||||||
|
Move_Calc (self, dest, train_spline_wait);
|
||||||
|
self->spawnflags |= TRAIN_START_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
void func_train_spline_find (edict_t *self)
|
||||||
|
{
|
||||||
|
edict_t *ent;
|
||||||
|
|
||||||
|
if (!self->target)
|
||||||
|
{
|
||||||
|
gi.dprintf ("train_spline_find: no target\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ent = G_PickTarget (self->target);
|
||||||
|
if (!ent)
|
||||||
|
{
|
||||||
|
gi.dprintf ("train_spline_find: target %s not found\n", self->target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lazarus: trains can change speed at path_corners
|
||||||
|
if(ent->speed) {
|
||||||
|
self->speed = ent->speed;
|
||||||
|
self->moveinfo.speed = self->speed;
|
||||||
|
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
|
||||||
|
}
|
||||||
|
if(ent->pitch_speed)
|
||||||
|
self->pitch_speed = ent->pitch_speed;
|
||||||
|
if(ent->yaw_speed)
|
||||||
|
self->yaw_speed = ent->yaw_speed;
|
||||||
|
if(ent->roll_speed)
|
||||||
|
self->roll_speed = ent->roll_speed;
|
||||||
|
|
||||||
|
// Lazarus: spline stuff
|
||||||
|
self->from = self->to = ent;
|
||||||
|
|
||||||
|
self->target = ent->target;
|
||||||
|
|
||||||
|
ent->think = train_spline_move;
|
||||||
|
ent->enemy = self;
|
||||||
|
ent->nextthink = level.time + FRAMETIME;
|
||||||
|
|
||||||
|
VectorSubtract (ent->s.origin, self->mins, self->s.origin);
|
||||||
|
gi.linkentity (self);
|
||||||
|
|
||||||
|
// if not triggered, start immediately
|
||||||
|
if (!self->targetname)
|
||||||
|
self->spawnflags |= TRAIN_START_ON;
|
||||||
|
|
||||||
|
if (self->spawnflags & TRAIN_START_ON)
|
||||||
|
{
|
||||||
|
// Lazarus: animated trains
|
||||||
|
if (self->spawnflags & TRAIN_ANIMATE)
|
||||||
|
self->s.effects |= EF_ANIM_ALL;
|
||||||
|
else if (self->spawnflags & TRAIN_ANIMATE_FAST)
|
||||||
|
self->s.effects |= EF_ANIM_ALLFAST;
|
||||||
|
|
||||||
|
self->nextthink = level.time + FRAMETIME;
|
||||||
|
self->think = train_spline_next;
|
||||||
|
self->activator = self;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void train_spline_use (edict_t *self, edict_t *other, edict_t *activator)
|
||||||
|
{
|
||||||
|
self->activator = activator;
|
||||||
|
|
||||||
|
if (self->spawnflags & TRAIN_START_ON)
|
||||||
|
{
|
||||||
|
if (!(self->spawnflags & TRAIN_TOGGLE))
|
||||||
|
return;
|
||||||
|
self->spawnflags &= ~TRAIN_START_ON;
|
||||||
|
VectorClear (self->velocity);
|
||||||
|
VectorClear (self->avelocity);
|
||||||
|
self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST);
|
||||||
|
self->nextthink = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (self->spawnflags & TRAIN_ANIMATE)
|
||||||
|
self->s.effects |= EF_ANIM_ALL;
|
||||||
|
else if (self->spawnflags & TRAIN_ANIMATE_FAST)
|
||||||
|
self->s.effects |= EF_ANIM_ALLFAST;
|
||||||
|
|
||||||
|
if (self->target_ent)
|
||||||
|
train_spline_resume(self);
|
||||||
|
else
|
||||||
|
train_spline_next(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SP_func_train_spline (edict_t *self)
|
||||||
|
{
|
||||||
|
self->movetype = MOVETYPE_PUSH;
|
||||||
|
|
||||||
|
VectorClear (self->s.angles);
|
||||||
|
self->blocked = train_blocked;
|
||||||
|
if (self->spawnflags & TRAIN_BLOCK_STOPS)
|
||||||
|
self->dmg = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!self->dmg)
|
||||||
|
self->dmg = 100;
|
||||||
|
}
|
||||||
|
self->solid = SOLID_BSP;
|
||||||
|
gi.setmodel (self, self->model);
|
||||||
|
|
||||||
|
if (st.noise)
|
||||||
|
self->moveinfo.sound_middle = gi.soundindex (st.noise);
|
||||||
|
|
||||||
|
if (!self->speed)
|
||||||
|
self->speed = 100;
|
||||||
|
|
||||||
|
// Lazarus: Do NOT set default values for rotational speeds - if they're 0, then they're 0.
|
||||||
|
|
||||||
|
self->moveinfo.speed = self->speed;
|
||||||
|
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
|
||||||
|
self->use = train_spline_use;
|
||||||
|
|
||||||
|
// Lazarus: damageable
|
||||||
|
if (self->health) {
|
||||||
|
self->die = train_die;
|
||||||
|
self->takedamage = DAMAGE_YES;
|
||||||
|
} else {
|
||||||
|
self->die = NULL;
|
||||||
|
self->takedamage = DAMAGE_NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.linkentity (self);
|
||||||
|
if (self->target)
|
||||||
|
{
|
||||||
|
// start trains on the second frame, to make sure their targets have had
|
||||||
|
// a chance to spawn
|
||||||
|
self->nextthink = level.time + FRAMETIME;
|
||||||
|
self->think = func_train_spline_find;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gi.dprintf ("func_train_spline without a target at %s\n", vtos(self->absmin));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lazarus: TRAIN_SMOOTH forces trains to go directly to Move_Done from
|
||||||
|
// Move_Final rather than slowing down (if necessary) for one
|
||||||
|
// frame.
|
||||||
|
if (self->spawnflags & TRAIN_SMOOTH)
|
||||||
|
self->smooth_movement = true;
|
||||||
|
else
|
||||||
|
self->smooth_movement = false;
|
||||||
|
|
||||||
|
// Lazarus: make noise field work w/o origin brush
|
||||||
|
// ver. 1.3 change - do this for ALL trains
|
||||||
|
// if(st.noise && !VectorLength(self->s.origin) )
|
||||||
|
if(st.noise)
|
||||||
|
{
|
||||||
|
edict_t *speaker;
|
||||||
|
|
||||||
|
self->noise_index = self->moveinfo.sound_middle;
|
||||||
|
self->moveinfo.sound_middle = 0;
|
||||||
|
speaker = G_Spawn();
|
||||||
|
speaker->classname = "moving_speaker";
|
||||||
|
speaker->s.sound = 0;
|
||||||
|
speaker->volume = 1;
|
||||||
|
speaker->attenuation = 1;
|
||||||
|
speaker->owner = self;
|
||||||
|
speaker->think = Moving_Speaker_Think;
|
||||||
|
speaker->nextthink = level.time + 2*FRAMETIME;
|
||||||
|
speaker->spawnflags = 7; // owner must be moving to play
|
||||||
|
self->speaker = speaker;
|
||||||
|
if(VectorLength(self->s.origin))
|
||||||
|
VectorCopy(self->s.origin,speaker->s.origin);
|
||||||
|
else {
|
||||||
|
VectorAdd(self->absmin,self->absmax,speaker->s.origin);
|
||||||
|
VectorScale(speaker->s.origin,0.5,speaker->s.origin);
|
||||||
|
}
|
||||||
|
VectorSubtract(speaker->s.origin,self->s.origin,speaker->offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
903
src/removed/majbitch.c
Normal file
903
src/removed/majbitch.c
Normal file
|
@ -0,0 +1,903 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL ((void *)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
typedef float vec_t;
|
||||||
|
typedef vec_t vec3_t[3];
|
||||||
|
|
||||||
|
#define LUMP_ENTDATA 0
|
||||||
|
#define LUMP_PLANES 1
|
||||||
|
#define LUMP_VERTEX 2
|
||||||
|
#define LUMP_VISLIST 3
|
||||||
|
#define LUMP_NODES 4
|
||||||
|
#define LUMP_TEXINFO 5
|
||||||
|
#define LUMP_FACES 6
|
||||||
|
#define LUMP_LIGHTDATA 7
|
||||||
|
#define LUMP_LEAFS 8
|
||||||
|
#define LUMP_LEAFFACES 9
|
||||||
|
#define LUMP_LEAFBRUSHES 10
|
||||||
|
#define LUMP_EDGES 11
|
||||||
|
#define LUMP_SURFEDGES 12
|
||||||
|
#define LUMP_MODELS 13
|
||||||
|
#define LUMP_BRUSHES 14
|
||||||
|
#define LUMP_BRUSHSIDES 15
|
||||||
|
#define LUMP_POP 16
|
||||||
|
#define LUMP_AREAS 17
|
||||||
|
#define LUMP_AREAPORTALS 18
|
||||||
|
#define LUMP_HEADER 19
|
||||||
|
|
||||||
|
#define MAX_MAP_AREAS 256
|
||||||
|
#define MAX_MAP_AREAPORTALS 1024
|
||||||
|
#define MAX_MAP_MODELS 1024
|
||||||
|
#define MAX_MAP_ENTITIES 2048
|
||||||
|
#define MAX_MAP_BRUSHES 8192
|
||||||
|
#define MAX_MAP_TEXINFO 8192
|
||||||
|
#define MAX_MAP_PLANES 65536
|
||||||
|
#define MAX_MAP_NODES 65536
|
||||||
|
#define MAX_MAP_BRUSHSIDES 65536
|
||||||
|
#define MAX_MAP_LEAFS 65536
|
||||||
|
#define MAX_MAP_VERTS 65536
|
||||||
|
#define MAX_MAP_FACES 65536
|
||||||
|
#define MAX_MAP_LEAFFACES 65536
|
||||||
|
#define MAX_MAP_LEAFBRUSHES 65536
|
||||||
|
#define MAX_MAP_PORTALS 65536
|
||||||
|
#define MAX_MAP_EDGES 128000
|
||||||
|
#define MAX_MAP_SURFEDGES 256000
|
||||||
|
|
||||||
|
#define MAX_MAP_ENTSTRING 0x40000
|
||||||
|
#define MAX_MAP_LIGHTING 0x200000
|
||||||
|
#define MAX_MAP_VISIBILITY 0x100000
|
||||||
|
|
||||||
|
// 0-2 are axial planes
|
||||||
|
#define PLANE_X 0
|
||||||
|
#define PLANE_Y 1
|
||||||
|
#define PLANE_Z 2
|
||||||
|
|
||||||
|
// 3-5 are non-axial planes
|
||||||
|
#define PLANE_ANYX 3
|
||||||
|
#define PLANE_ANYY 4
|
||||||
|
#define PLANE_ANYZ 5
|
||||||
|
|
||||||
|
#define DVIS_PVS 0 // vis.bitofs[][0]
|
||||||
|
#define DVIS_PHS 1 // vis.bitofs[][1]
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
|
||||||
|
//=============================
|
||||||
|
// Entire BSP Tree Structures
|
||||||
|
//=============================
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float normal[3]; // normal to this plane
|
||||||
|
float dist; // used with normal to determine front/back of plane
|
||||||
|
int type; // type of plane, (see: PLANE_X ... PLANE_ANYZ)
|
||||||
|
} plane_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float origin[3]; // location of this vertex
|
||||||
|
} vertex_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float blend[2][4]; // [s/t][4] - see q2 blend[] // Maj++ renamed
|
||||||
|
int flags; // miptex flags (See SURF_* flag types)
|
||||||
|
int value; // light emission
|
||||||
|
char texture[32]; // texture name (ie, "SKY")
|
||||||
|
int nexttexinfo; // next texinfo (-1 = end of chain)
|
||||||
|
} texinfo_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
byte lightchar[1];
|
||||||
|
} lightdata_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short planenum; // map->plane[]
|
||||||
|
short side; // 0 or 1 -1=none
|
||||||
|
int firstedge; // map->edge[]
|
||||||
|
short numedges; // total edges associated with this face
|
||||||
|
short texinfo; // map->texinfo[]
|
||||||
|
byte lightstyle[4];// see Q2 lightstyles..
|
||||||
|
int lightofs; // map->lightdata[]
|
||||||
|
} face_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int planenum; // map->plane[]
|
||||||
|
int right; // child[0]: -1=leaf[-(right+1)],otherwise index to child node
|
||||||
|
int left; // child[1]: -1=leaf[-(left+1)], otherwise index to child node
|
||||||
|
short mins[3]; // minsize of this node (for tracing).
|
||||||
|
short maxs[3]; // maxsize of this node (for tracing).
|
||||||
|
short firstface; // map->face[]
|
||||||
|
short numfaces; // total faces associated with this node
|
||||||
|
} node_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int portalnum; // number of this areaportal
|
||||||
|
int nextarea; // connected area[]
|
||||||
|
} areaportal_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int numareaportals; // total areaportals associated with this area
|
||||||
|
int firstareaportal; // map->areaportal[]
|
||||||
|
} area_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short dleaffaces[MAX_MAP_LEAFFACES]; // map->face[]
|
||||||
|
} leafface_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short planenum; // map->plane[]
|
||||||
|
short texinfo; // map->texinfo[]
|
||||||
|
} brushside_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int firstbrushside;// map->brushside[]
|
||||||
|
int numbrushsides; // total brushsides associated with this surface
|
||||||
|
int contents; // pointcontents of this surface..
|
||||||
|
} brush_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short dleafbrushes[MAX_MAP_LEAFBRUSHES]; // map->brush[]
|
||||||
|
} leafbrush_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int numclusters; // ????
|
||||||
|
int bitofs[8][2];// ????
|
||||||
|
} vis_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int contents; // pointcontents of this leaf
|
||||||
|
short cluster; //
|
||||||
|
short area; //
|
||||||
|
short mins[3]; // size of leaf
|
||||||
|
short maxs[3]; // size of leaf
|
||||||
|
short firstleafface; // map->leafface[]
|
||||||
|
short numleaffaces; // total leaffaces associated with this leaf
|
||||||
|
short firstleafbrush; // map->leafbrushes[]
|
||||||
|
short numleafbrushes; // total leafbrushes associated with this leaf
|
||||||
|
} leaf_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short v[2]; // vertex[xy] of this edge
|
||||||
|
} edge_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int dsurfedges[1];// map->edge[]
|
||||||
|
} surfedge_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
byte dpop[256]; // ???????
|
||||||
|
} pop_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float mins[3]; // size of model
|
||||||
|
float maxs[3]; // size of model
|
||||||
|
float origin[3]; // location of model
|
||||||
|
long rootnode; // start of BSP tree
|
||||||
|
long firstface; // map->face[]
|
||||||
|
long numfaces; // total faces associated with this model
|
||||||
|
} model_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char entchar[MAX_MAP_ENTSTRING]; // map entities??? Maj++
|
||||||
|
} entdata_t;
|
||||||
|
|
||||||
|
//===============================================
|
||||||
|
typedef struct cplane_s {
|
||||||
|
vec3_t normal; // normal vector
|
||||||
|
float dist; // distance
|
||||||
|
byte type; // for fast side tests
|
||||||
|
byte signbits; // direction of normal
|
||||||
|
byte pad[2]; // unused
|
||||||
|
} cplane_t;
|
||||||
|
|
||||||
|
//=============================
|
||||||
|
// BSP Header Structures
|
||||||
|
//=============================
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int fileofs;
|
||||||
|
int filelen;
|
||||||
|
} lump_t;
|
||||||
|
|
||||||
|
// LUMP_HEADER
|
||||||
|
typedef struct {
|
||||||
|
char string[4];
|
||||||
|
long version;
|
||||||
|
lump_t lumps[LUMP_HEADER];
|
||||||
|
} header_t;
|
||||||
|
|
||||||
|
header_t header;
|
||||||
|
|
||||||
|
//===================================
|
||||||
|
// Map structure (w/o header)..
|
||||||
|
//===================================
|
||||||
|
typedef struct map_s {
|
||||||
|
int num_entdatas;// count of entdata_t's.
|
||||||
|
entdata_t *entdata; // 0=LUMP INDEX
|
||||||
|
int num_planes; // count of plane_t's
|
||||||
|
cplane_t *plane; // 1=LUMP INDEX
|
||||||
|
int num_vertexs;
|
||||||
|
vertex_t *vertex; // 2
|
||||||
|
int num_viss;
|
||||||
|
vis_t *vis; // 3
|
||||||
|
int num_nodes;
|
||||||
|
node_t *node; // 4
|
||||||
|
int num_texinfos;
|
||||||
|
texinfo_t *texinfo; // 5
|
||||||
|
int num_faces;
|
||||||
|
face_t *face; // 6
|
||||||
|
long int num_lightchars;
|
||||||
|
lightdata_t *lightdata; // 7
|
||||||
|
int num_leafs;
|
||||||
|
leaf_t *leaf; // 8
|
||||||
|
int num_leaffaces;
|
||||||
|
leafface_t *leafface; // 9
|
||||||
|
int num_leafbrushes;
|
||||||
|
leafbrush_t *leafbrush; // 10
|
||||||
|
int num_edges;
|
||||||
|
edge_t *edge; // 11
|
||||||
|
long int num_surfedges;
|
||||||
|
surfedge_t *surfedge; // 12
|
||||||
|
int num_models;
|
||||||
|
model_t *model; // 13
|
||||||
|
int num_brushes;
|
||||||
|
brush_t *brush; // 14
|
||||||
|
int num_brushsides;
|
||||||
|
brushside_t *brushside; // 15
|
||||||
|
int num_popchars;
|
||||||
|
pop_t *pop; // 16
|
||||||
|
int num_areas;
|
||||||
|
area_t *area; // 17
|
||||||
|
int num_areaportals;
|
||||||
|
areaportal_t *areaportal; // 18
|
||||||
|
} map_t;
|
||||||
|
|
||||||
|
map_t *map;
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
//========== MEMORY ALLOCATION ROUTINES ============
|
||||||
|
//==================================================
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
void *xmalloc(unsigned long size) {
|
||||||
|
void *mem;
|
||||||
|
|
||||||
|
mem = malloc(size);
|
||||||
|
if (!mem){
|
||||||
|
fprintf(stderr, "xmalloc: %s\n", strerror(errno));
|
||||||
|
exit(1); }
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
//==================================================
|
||||||
|
//============= DATA BUFFER READING ================
|
||||||
|
//==================================================
|
||||||
|
|
||||||
|
unsigned long getp; // Location of pointer in buffer
|
||||||
|
unsigned long numbytes; // Size of buffer (in bytes)
|
||||||
|
unsigned char *buffer; // Pointer to buffered data.
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
// Move num bytes from location into address
|
||||||
|
//==================================================
|
||||||
|
void getmem(void *addr, unsigned long bytes) {
|
||||||
|
memmove(addr, buffer+getp, bytes);
|
||||||
|
getp += bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
//========= ROUTINES FOR READING BSP STRUCTS ==========
|
||||||
|
//=====================================================
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 0 - Read all BSP entdata chars from buffer.
|
||||||
|
//=====================================================
|
||||||
|
entdata_t *read_entdata(void) {
|
||||||
|
entdata_t *entdata;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of entdata_t data
|
||||||
|
getp = header.lumps[LUMP_ENTDATA].fileofs;
|
||||||
|
|
||||||
|
// How many entdata chars are there?
|
||||||
|
map->num_entdatas = header.lumps[LUMP_ENTDATA].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "entdata count=%d\n",map->num_entdatas);
|
||||||
|
|
||||||
|
if (map->num_entdatas <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 entdata_t structure
|
||||||
|
entdata = (entdata_t *)xmalloc(sizeof(entdata_t));
|
||||||
|
|
||||||
|
// Sequentially read entchar[] chars from buffer
|
||||||
|
for (i=0; i < map->num_entdatas; i++)
|
||||||
|
getmem((void *)&entdata->entchar[i],sizeof(entdata->entchar[0]));
|
||||||
|
|
||||||
|
return entdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 1 - Read all BSP plane structs from buffer.
|
||||||
|
// Modified to use cplane_t instead
|
||||||
|
//=====================================================
|
||||||
|
cplane_t *read_planes(void) {
|
||||||
|
cplane_t *plane;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of plane_t data
|
||||||
|
getp = header.lumps[LUMP_PLANES].fileofs;
|
||||||
|
|
||||||
|
// How many plane_t records are there?
|
||||||
|
map->num_planes = header.lumps[LUMP_PLANES].filelen/sizeof(plane_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "plane count=%d\n",map->num_planes);
|
||||||
|
|
||||||
|
if (map->num_planes <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all plane_t structures for num_planes
|
||||||
|
plane = (cplane_t *)xmalloc(map->num_planes*sizeof(cplane_t));
|
||||||
|
|
||||||
|
// Sequentially read plane_t structs from buffer
|
||||||
|
for (i=0; i < map->num_planes; i++) {
|
||||||
|
getmem((void *)&plane[i],sizeof(plane_t));
|
||||||
|
|
||||||
|
plane[i].signbits=(int)(plane[i].normal[0] < 0.0F);
|
||||||
|
|
||||||
|
if (plane[i].normal[1] < 0.0F)
|
||||||
|
plane[i].signbits |= 2;
|
||||||
|
|
||||||
|
if (plane[i].normal[2] < 0.0F)
|
||||||
|
plane[i].signbits |= 4;
|
||||||
|
|
||||||
|
plane[i].pad[0] = 0;
|
||||||
|
plane[i].pad[1] = 0; }
|
||||||
|
|
||||||
|
return plane;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 2 - Read all BSP vertex structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
vertex_t *read_vertexs(void) {
|
||||||
|
vertex_t *vertex;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of vertex_t data
|
||||||
|
getp = header.lumps[LUMP_VERTEX].fileofs;
|
||||||
|
|
||||||
|
// How many vertex_t records are there?
|
||||||
|
map->num_vertexs = header.lumps[LUMP_VERTEX].filelen/sizeof(vertex_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "vertex count=%d\n",map->num_vertexs);
|
||||||
|
|
||||||
|
if (map->num_vertexs <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all vertex_t structures for num_vertexs
|
||||||
|
vertex = (vertex_t *)xmalloc(map->num_vertexs*sizeof(vertex_t));
|
||||||
|
|
||||||
|
// Sequentially read vertex_t structs from buffer
|
||||||
|
for (i=0; i < map->num_vertexs; i++)
|
||||||
|
getmem((void *)&vertex[i],sizeof(vertex_t));
|
||||||
|
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 3 - Read all BSP vis structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
vis_t *read_vis(void) {
|
||||||
|
vis_t *viss;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of vis_t data
|
||||||
|
getp = header.lumps[LUMP_VISLIST].fileofs;
|
||||||
|
|
||||||
|
// How many vis_t records are there?
|
||||||
|
map->num_viss = header.lumps[LUMP_VISLIST].filelen/sizeof(vis_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "vis count=%d\n",map->num_viss);
|
||||||
|
|
||||||
|
if (map->num_viss <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all vis_t structures for num_viss
|
||||||
|
viss = (vis_t *)xmalloc(map->num_viss*sizeof(vis_t));
|
||||||
|
|
||||||
|
// Sequentially read vis_t structs from buffer
|
||||||
|
for (i=0; i < map->num_viss; i++)
|
||||||
|
getmem((void *)&viss[i],sizeof(vis_t));
|
||||||
|
|
||||||
|
return viss;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 4 - Read all BSP node structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
node_t *read_nodes(void) {
|
||||||
|
node_t *node;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of node_t data
|
||||||
|
getp = header.lumps[LUMP_NODES].fileofs;
|
||||||
|
|
||||||
|
// How many node_t records are there?
|
||||||
|
map->num_nodes = header.lumps[LUMP_NODES].filelen/sizeof(node_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "node count=%d\n",map->num_nodes);
|
||||||
|
|
||||||
|
if (map->num_nodes <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all node_t structures for num_nodes
|
||||||
|
node = (node_t *)xmalloc(map->num_nodes*sizeof(node_t));
|
||||||
|
|
||||||
|
// Sequentially read node_t structs from buffer
|
||||||
|
for (i=0; i < map->num_nodes; i++)
|
||||||
|
getmem((void *)&node[i],sizeof(node_t));
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 5 - Read all BSP texinfo structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
texinfo_t *read_texinfo(void) {
|
||||||
|
texinfo_t *texinfo;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of texinfo_t data
|
||||||
|
getp = header.lumps[LUMP_TEXINFO].fileofs;
|
||||||
|
|
||||||
|
// How many texinfo_t records are there?
|
||||||
|
map->num_texinfos = header.lumps[LUMP_TEXINFO].filelen/sizeof(texinfo_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "texinfo count=%d\n",map->num_texinfos);
|
||||||
|
|
||||||
|
if (map->num_texinfos <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all texinfo_t structures for num_texinfos
|
||||||
|
texinfo = (texinfo_t *)xmalloc(map->num_texinfos*sizeof(texinfo_t));
|
||||||
|
|
||||||
|
// Sequentially read texinfo_t structs from buffer
|
||||||
|
for (i=0; i < map->num_texinfos; i++)
|
||||||
|
getmem((void *)&texinfo[i],sizeof(texinfo_t));
|
||||||
|
|
||||||
|
return texinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 6 - Read all BSP face structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
face_t *read_faces(void) {
|
||||||
|
face_t *face;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of face_t data
|
||||||
|
getp = header.lumps[LUMP_FACES].fileofs;
|
||||||
|
|
||||||
|
// How many face_t records are there?
|
||||||
|
map->num_faces = header.lumps[LUMP_FACES].filelen/sizeof(face_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "face count=%d\n",map->num_faces);
|
||||||
|
|
||||||
|
if (map->num_faces <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all face_t structures for num_faces
|
||||||
|
face = (face_t *)xmalloc(map->num_faces*sizeof(face_t));
|
||||||
|
|
||||||
|
// Sequentially read face_t structs from buffer
|
||||||
|
for (i=0; i < map->num_faces; i++)
|
||||||
|
getmem((void *)&face[i],sizeof(face_t));
|
||||||
|
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 7 - Read all BSP lightdata chars from buffer.
|
||||||
|
//=====================================================
|
||||||
|
lightdata_t *read_lightdata(void) {
|
||||||
|
lightdata_t *lightdata;
|
||||||
|
lightdata_t templight;
|
||||||
|
long int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of lightdata_t data
|
||||||
|
getp = header.lumps[LUMP_LIGHTDATA].fileofs;
|
||||||
|
|
||||||
|
// How many lightdata chars are there?
|
||||||
|
map->num_lightchars = header.lumps[LUMP_LIGHTDATA].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "lightdata count=%d\n",map->num_lightchars);
|
||||||
|
|
||||||
|
if (map->num_lightchars <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 lightdata_t structure
|
||||||
|
lightdata = (lightdata_t *)xmalloc(map->num_lightchars*sizeof(templight.lightchar[0]));
|
||||||
|
|
||||||
|
// Sequentially read all lightchar[] chars from buffer
|
||||||
|
for (i=0; i < map->num_lightchars; i++)
|
||||||
|
getmem((void *)&lightdata->lightchar[i],sizeof(lightdata->lightchar[0]));
|
||||||
|
|
||||||
|
return lightdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 8 - Read all BSP leaf structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
leaf_t *read_leafs(void) {
|
||||||
|
leaf_t *leaf;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of leaf_t data
|
||||||
|
getp = header.lumps[LUMP_LEAFS].fileofs;
|
||||||
|
|
||||||
|
// How many leaf_t records are there?
|
||||||
|
map->num_leafs = header.lumps[LUMP_LEAFS].filelen/sizeof(leaf_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "leaf count=%d\n",map->num_leafs);
|
||||||
|
|
||||||
|
if (map->num_leafs <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all leaf_t structures for num_leafs
|
||||||
|
leaf = (leaf_t *)xmalloc(map->num_leafs*sizeof(leaf_t));
|
||||||
|
|
||||||
|
// Sequentially read leaf_t structs from buffer
|
||||||
|
for (i=0; i < map->num_leafs; i++)
|
||||||
|
getmem((void *)&leaf[i],sizeof(leaf_t));
|
||||||
|
|
||||||
|
return leaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 9 - Read all BSP leafface structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
leafface_t *read_leaffaces(void) {
|
||||||
|
leafface_t *leafface;
|
||||||
|
leafface_t tempface;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of leafface_t data
|
||||||
|
getp = header.lumps[LUMP_LEAFFACES].fileofs;
|
||||||
|
|
||||||
|
// How many leafface_t records are there?
|
||||||
|
map->num_leaffaces = header.lumps[LUMP_LEAFFACES].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "leafface count=%d\n",map->num_leaffaces);
|
||||||
|
|
||||||
|
if (map->num_leaffaces <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 leafface_t structure
|
||||||
|
leafface = (leafface_t *)xmalloc(map->num_leaffaces*sizeof(tempface.dleaffaces[0]));
|
||||||
|
|
||||||
|
// Sequentially read all dleafface[] chars from buffer
|
||||||
|
for (i=0; i < map->num_leaffaces; i++)
|
||||||
|
getmem((void *)&leafface->dleaffaces[i],sizeof(leafface->dleaffaces[0]));
|
||||||
|
|
||||||
|
return leafface;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 10 - Read all BSP leafbrush chars from buffer.
|
||||||
|
//=====================================================
|
||||||
|
leafbrush_t *read_leafbrushes(void) {
|
||||||
|
leafbrush_t *leafbrush;
|
||||||
|
leafbrush_t tempbrush;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of leafbrush_t data
|
||||||
|
getp = header.lumps[LUMP_LEAFBRUSHES].fileofs;
|
||||||
|
|
||||||
|
// How many leafbrush_t records are there?
|
||||||
|
map->num_leafbrushes = header.lumps[LUMP_LEAFBRUSHES].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "leafbrush count=%d\n",map->num_leafbrushes);
|
||||||
|
|
||||||
|
if (map->num_leafbrushes <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 leafbrush_t structure
|
||||||
|
leafbrush = (leafbrush_t *)xmalloc(map->num_leafbrushes*sizeof(tempbrush.dleafbrushes[0]));
|
||||||
|
|
||||||
|
// Sequentially read all dleafbrushes[] chars from buffer
|
||||||
|
for (i=0; i < map->num_leafbrushes; i++)
|
||||||
|
getmem((void *)&leafbrush->dleafbrushes[i],sizeof(leafbrush->dleafbrushes[0]));
|
||||||
|
|
||||||
|
return leafbrush;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 11 - Read all BSP edge structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
edge_t *read_edges(void) {
|
||||||
|
edge_t *edge;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of edge_t data
|
||||||
|
getp = header.lumps[LUMP_EDGES].fileofs;
|
||||||
|
|
||||||
|
// How many edge_t records are there?
|
||||||
|
map->num_edges = header.lumps[LUMP_EDGES].filelen/sizeof(edge_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "edge count=%d\n",map->num_edges);
|
||||||
|
|
||||||
|
if (map->num_edges <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all edge_t structures for num_edges
|
||||||
|
edge = (edge_t *)xmalloc(map->num_edges*sizeof(edge_t));
|
||||||
|
|
||||||
|
// Sequentially read edge_t structs from buffer
|
||||||
|
for (i=0; i < map->num_edges; i++)
|
||||||
|
getmem((void *)&edge[i],sizeof(edge_t));
|
||||||
|
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 12 - Read all BSP surfedge chars from buffer.
|
||||||
|
//=====================================================
|
||||||
|
surfedge_t *read_surfedges(void) {
|
||||||
|
surfedge_t *surfedge;
|
||||||
|
surfedge_t surftemp;
|
||||||
|
long int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of surfedge_t data
|
||||||
|
getp = header.lumps[LUMP_SURFEDGES].fileofs;
|
||||||
|
|
||||||
|
// How many surfedge_t records are there?
|
||||||
|
map->num_surfedges = header.lumps[LUMP_SURFEDGES].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "surfedge count=%d\n",map->num_surfedges);
|
||||||
|
|
||||||
|
if (map->num_surfedges <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 surfedge_t structure
|
||||||
|
surfedge = (surfedge_t *) xmalloc(map->num_surfedges*sizeof(surftemp.dsurfedges[0]));
|
||||||
|
|
||||||
|
// Sequentially read all dsurfedges[] chars from buffer
|
||||||
|
for (i=0; i < map->num_surfedges; i++)
|
||||||
|
getmem((void *)&surfedge->dsurfedges[i],sizeof(surfedge->dsurfedges[0]));
|
||||||
|
|
||||||
|
return surfedge;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 13 - Read all BSP model structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
model_t *read_models(void) {
|
||||||
|
model_t *model;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of model_t data
|
||||||
|
getp = header.lumps[LUMP_MODELS].fileofs;
|
||||||
|
|
||||||
|
// How many model_t records are there?
|
||||||
|
map->num_models = header.lumps[LUMP_MODELS].filelen/sizeof(model_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "model count=%d\n",map->num_models);
|
||||||
|
|
||||||
|
if (map->num_models <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all model_t structures for num_models
|
||||||
|
model = (model_t *)xmalloc(map->num_models*sizeof(model_t));
|
||||||
|
|
||||||
|
// Sequentially read model_t structs from buffer
|
||||||
|
for (i=0; i < map->num_models; i++)
|
||||||
|
getmem((void *)&model[i],sizeof(model_t));
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 14 - Read all BSP brush structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
brush_t *read_brushes(void) {
|
||||||
|
brush_t *brush;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of brush_t data
|
||||||
|
getp = header.lumps[LUMP_BRUSHES].fileofs;
|
||||||
|
|
||||||
|
// How many brush_t records are there?
|
||||||
|
map->num_brushes = header.lumps[LUMP_BRUSHES].filelen/sizeof(brush_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "brush count=%d\n",map->num_brushes);
|
||||||
|
|
||||||
|
if (map->num_brushes <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all brush_t structures for num_brushes
|
||||||
|
brush = (brush_t *)xmalloc(map->num_brushes*sizeof(brush_t));
|
||||||
|
|
||||||
|
// Sequentially read brush_t structs from buffer
|
||||||
|
for (i=0; i < map->num_brushes; i++)
|
||||||
|
getmem((void *)&brush[i],sizeof(brush_t));
|
||||||
|
|
||||||
|
return brush;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 15 - Read all BSP brushside structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
brushside_t *read_brushsides(void) {
|
||||||
|
brushside_t *brushside;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of brushside_t data
|
||||||
|
getp = header.lumps[LUMP_BRUSHSIDES].fileofs;
|
||||||
|
|
||||||
|
// How many brushside_t records are there?
|
||||||
|
map->num_brushsides = header.lumps[LUMP_BRUSHSIDES].filelen/sizeof(brushside_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "brushside count=%d\n",map->num_brushsides);
|
||||||
|
|
||||||
|
if (map->num_brushsides <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all brushside_t structures for num_brushsides
|
||||||
|
brushside = (brushside_t *)xmalloc(map->num_brushsides*sizeof(brushside_t));
|
||||||
|
|
||||||
|
// Sequentially read brushside_t structs from buffer
|
||||||
|
for (i=0; i < map->num_brushsides; i++)
|
||||||
|
getmem((void *)&brushside[i],sizeof(brushside_t));
|
||||||
|
|
||||||
|
return brushside;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 16 - Read all BSP pop chars from buffer.
|
||||||
|
//=====================================================
|
||||||
|
pop_t *read_pop(void) {
|
||||||
|
pop_t *pop;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of pop_t data
|
||||||
|
getp = header.lumps[LUMP_POP].fileofs;
|
||||||
|
|
||||||
|
// How many pop chars are there?
|
||||||
|
map->num_popchars = header.lumps[LUMP_POP].filelen;
|
||||||
|
|
||||||
|
fprintf(stderr, "pop count=%d\n",map->num_popchars);
|
||||||
|
|
||||||
|
if (map->num_popchars <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate 1 pop_t structure
|
||||||
|
pop = (pop_t *)xmalloc(sizeof(pop_t));
|
||||||
|
|
||||||
|
// Sequentially read dpop[] bytes from buffer
|
||||||
|
for (i=0; i < map->num_popchars; i++)
|
||||||
|
getmem((void *)&pop->dpop[i],sizeof(pop->dpop[0]));
|
||||||
|
|
||||||
|
return pop;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 17 - Read all BSP area structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
area_t *read_areas(void) {
|
||||||
|
area_t *area;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of area_t data
|
||||||
|
getp = header.lumps[LUMP_AREAS].fileofs;
|
||||||
|
|
||||||
|
// How many area_t records are there?
|
||||||
|
map->num_areas = header.lumps[LUMP_AREAS].filelen/sizeof(area_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "area count=%d\n",map->num_areas);
|
||||||
|
|
||||||
|
if (map->num_areas <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all area_t structures for num_areas
|
||||||
|
area = (area_t *)xmalloc(map->num_areas*sizeof(area_t));
|
||||||
|
|
||||||
|
// Sequentially read area_t structs from buffer
|
||||||
|
for (i=0; i < map->num_areas; i++)
|
||||||
|
getmem((void *)&area[i],sizeof(area_t));
|
||||||
|
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================
|
||||||
|
// LUMP 18 - Read all BSP areaportal structs from buffer.
|
||||||
|
//=====================================================
|
||||||
|
areaportal_t *read_areaportals(void) {
|
||||||
|
areaportal_t *areaportal;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Set GET pointer to start of areaportal_t data
|
||||||
|
getp = header.lumps[LUMP_AREAPORTALS].fileofs;
|
||||||
|
|
||||||
|
// How many areaportal_t records are there?
|
||||||
|
map->num_areaportals = header.lumps[LUMP_AREAPORTALS].filelen/sizeof(areaportal_t);
|
||||||
|
|
||||||
|
fprintf(stderr, "areaportal count=%d\n",map->num_areaportals);
|
||||||
|
|
||||||
|
if (map->num_areaportals <= 0) return NULL;
|
||||||
|
|
||||||
|
// Allocate all areaportal_t structures for num_areaportals
|
||||||
|
areaportal = (areaportal_t *)xmalloc(map->num_areaportals*sizeof(areaportal_t));
|
||||||
|
|
||||||
|
// Sequentially read areaportal_t structs from buffer
|
||||||
|
for (i=0; i < map->num_areaportals; i++)
|
||||||
|
getmem((void *)&areaportal[i],sizeof(areaportal_t));
|
||||||
|
|
||||||
|
return areaportal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================
|
||||||
|
// Reads entire BSP file into map_t struct.
|
||||||
|
//================================================
|
||||||
|
void load_bsp_map(char *filepath) {
|
||||||
|
FILE *f;
|
||||||
|
long size;
|
||||||
|
|
||||||
|
f = fopen(filepath, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "fopen: %s\n", strerror(errno));
|
||||||
|
fclose(f);
|
||||||
|
return ; }
|
||||||
|
|
||||||
|
errno=0;
|
||||||
|
fseek(f, 0L, SEEK_END);
|
||||||
|
if (errno) {
|
||||||
|
fprintf(stderr, "fseek: %s\n", strerror(errno));
|
||||||
|
return ; }
|
||||||
|
|
||||||
|
errno=0;
|
||||||
|
size = ftell(f);
|
||||||
|
if (errno) {
|
||||||
|
fprintf(stderr, "ftell: %s\n", strerror(errno));
|
||||||
|
fclose(f);
|
||||||
|
return ; }
|
||||||
|
|
||||||
|
fseek(f, 0L, SEEK_SET);
|
||||||
|
buffer=xmalloc(size);
|
||||||
|
|
||||||
|
fread(buffer, 1, size, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
// Read BSP header
|
||||||
|
getmem((void*)&header,sizeof(header_t));
|
||||||
|
|
||||||
|
// Allocate entire map_t struct
|
||||||
|
map = (map_t *)xmalloc(sizeof(map_t));
|
||||||
|
|
||||||
|
map->entdata = read_entdata();
|
||||||
|
map->plane = read_planes();
|
||||||
|
map->vertex = read_vertexs();
|
||||||
|
map->vis = read_vis();
|
||||||
|
map->node = read_nodes();
|
||||||
|
map->texinfo = read_texinfo();
|
||||||
|
map->face = read_faces();
|
||||||
|
map->lightdata = read_lightdata();
|
||||||
|
map->leaf = read_leafs();
|
||||||
|
map->leafface = read_leaffaces();
|
||||||
|
map->leafbrush = read_leafbrushes();
|
||||||
|
map->edge = read_edges();
|
||||||
|
map->surfedge = read_surfedges();
|
||||||
|
map->model = read_models();
|
||||||
|
map->brush = read_brushes();
|
||||||
|
map->brushside = read_brushsides();
|
||||||
|
map->pop = read_pop();
|
||||||
|
map->area = read_areas();
|
||||||
|
map->areaportal = read_areaportals();
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
char t;
|
||||||
|
|
||||||
|
fprintf(stderr, "BSP Tree contains: \n");
|
||||||
|
fprintf(stderr, "----------------------\n");
|
||||||
|
load_bsp_map("c:\\quake2\\baseq2\\maps\\q2dm2.bsp");
|
||||||
|
fprintf(stderr, "----------------------\n\n\n\n");
|
||||||
|
|
||||||
|
printf("waiting for your input ");
|
||||||
|
t=getchar();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue