mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-15 09:21:55 +00:00
func_stasis_door
- Fixed bug leading to crash - Started to work door togling (just testing out a few things for now)
This commit is contained in:
parent
f6b13eb6c4
commit
43bd3c87dc
5 changed files with 53 additions and 146 deletions
|
@ -120,7 +120,7 @@ LUAOBJ = \
|
||||||
lzio.o
|
lzio.o
|
||||||
|
|
||||||
# do cc for shared library
|
# do cc for shared library
|
||||||
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -o $@ -c $<
|
DO_SOCC = $(CC) $(SOCFLAGS) -Wall -g3 -o $@ -c $<
|
||||||
# do cc for lua
|
# do cc for lua
|
||||||
DO_LUACC = $(CC) -O2 -Wall $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
|
DO_LUACC = $(CC) -O2 -Wall $(SOCFLAGS) -DLUA_COMPAT_ALL -o $@ -c $<
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// because games can change separately from the main system version, we need a
|
// because games can change separately from the main system version, we need a
|
||||||
// second version that must match between game and cgame
|
// second version that must match between game and cgame
|
||||||
#define RPGX_VERSION "RPG-X v2.2 wc121211a"
|
#define RPGX_VERSION "RPG-X v2.2 wc121211b"
|
||||||
#define RPGX_COMPILEDATE "20/05/11"
|
#define RPGX_COMPILEDATE "20/05/11"
|
||||||
#define RPGX_COMPILEDBY "GSIO01"
|
#define RPGX_COMPILEDBY "GSIO01"
|
||||||
//const char GAME_VERSION[] = strcat("RPG-X v",RPGX_VERSION);
|
//const char GAME_VERSION[] = strcat("RPG-X v",RPGX_VERSION);
|
||||||
|
|
193
game/g_mover.c
193
game/g_mover.c
|
@ -3353,101 +3353,6 @@ ent->n00bCount locked indicator
|
||||||
#define STASIS_DOOR_OPENING 3
|
#define STASIS_DOOR_OPENING 3
|
||||||
#define STASIS_DOOR_OPENED 4
|
#define STASIS_DOOR_OPENED 4
|
||||||
|
|
||||||
void toggle_stasis_door( gentity_t *ent );
|
|
||||||
|
|
||||||
/*
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
block_stasis_door
|
|
||||||
checks if someone is near the door
|
|
||||||
|
|
||||||
-------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void block_stasis_door( gentity_t *ent )
|
|
||||||
{
|
|
||||||
int ct = 0;
|
|
||||||
int i;
|
|
||||||
gentity_t *entity_list[MAX_GENTITIES];
|
|
||||||
|
|
||||||
// Do a quick check to see if someone is close to the door...pos1 is actually the door origin
|
|
||||||
ct = G_RadiusList( ent->pos1, 128, ent, qtrue, entity_list );
|
|
||||||
|
|
||||||
if ( ct )
|
|
||||||
{
|
|
||||||
for ( i = 0; i < ct; i++ )
|
|
||||||
{
|
|
||||||
if ( entity_list[i]->client )
|
|
||||||
{
|
|
||||||
ent->nextthink = level.time + 500; //blocked, check back in .5 secs
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->think = toggle_stasis_door;
|
|
||||||
ent->nextthink = level.time + 50;
|
|
||||||
}
|
|
||||||
G_Printf( "^1Entity blockcheck\n", 0 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
locked_stasis_door
|
|
||||||
checks if the door is locked and aborts if needed
|
|
||||||
|
|
||||||
-------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void locked_stasis_door( gentity_t *ent )
|
|
||||||
{
|
|
||||||
return; // do nothing for now
|
|
||||||
if ( ent->n00bCount == 2)
|
|
||||||
{
|
|
||||||
ent->think = toggle_stasis_door;
|
|
||||||
ent->nextthink = level.time + 50;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
G_Printf( "^1Entity lockcheck\n", 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
lockup_stasis_door
|
|
||||||
locks the door off
|
|
||||||
|
|
||||||
-------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void lockup_stasis_door( gentity_t *ent )
|
|
||||||
{
|
|
||||||
return; // do nothing for now
|
|
||||||
if ( ent->n00bCount == 2 )
|
|
||||||
{
|
|
||||||
ent->n00bCount = 1;
|
|
||||||
//show darker model
|
|
||||||
if ( ent->count == 2 ) //close door
|
|
||||||
{
|
|
||||||
ent->think = block_stasis_door;
|
|
||||||
ent->nextthink = level.time + 50;
|
|
||||||
}
|
|
||||||
// posibly message
|
|
||||||
}
|
|
||||||
else if ( ent->n00bCount == 1 )
|
|
||||||
{
|
|
||||||
ent->n00bCount = 2;
|
|
||||||
//show lighter model
|
|
||||||
// posibly message
|
|
||||||
}
|
|
||||||
G_Printf( "^1Entity lock-toggle\n", 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
@ -3460,41 +3365,41 @@ will manage the door-toggeling
|
||||||
|
|
||||||
void toggle_stasis_door( gentity_t *ent )
|
void toggle_stasis_door( gentity_t *ent )
|
||||||
{
|
{
|
||||||
|
gentity_t *parent = ent->parent;
|
||||||
ent->nextthink = -1; // prevent thinking again until this think is finished
|
ent->nextthink = -1; // prevent thinking again until this think is finished
|
||||||
if ( ent->wait >= 0 )
|
parent->nextthink = -1;
|
||||||
{
|
G_Printf(S_COLOR_MAGENTA"toggle_stasis_door\n");
|
||||||
ent->think = locked_stasis_door;
|
parent->r.contents = CONTENTS_NONE;
|
||||||
ent->nextthink = level.time + 50;
|
parent->r.svFlags ^= SVF_NOCLIENT;
|
||||||
}
|
trap_LinkEntity(parent);
|
||||||
else
|
/*switch(parent->count) {
|
||||||
{
|
case STASIS_DOOR_CLOSED: // then go to opening state
|
||||||
ent->think = toggle_stasis_door;
|
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSED\n");
|
||||||
switch(ent->count) {
|
G_AddEvent(parent, EV_STASIS_DOOR_OPENING, 0); // send event to client
|
||||||
case STASIS_DOOR_CLOSED: // then go to opening state
|
parent->count = STASIS_DOOR_OPENING;
|
||||||
G_AddEvent(ent, EV_STASIS_DOOR_OPENING, 0); // send event to client
|
parent->nextthink = level.time + 1000;
|
||||||
ent->count = STASIS_DOOR_OPENING;
|
break;
|
||||||
ent->nextthink = level.time + 1000;
|
case STASIS_DOOR_CLOSING: // then go to closed state
|
||||||
break;
|
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSING\n");
|
||||||
case STASIS_DOOR_CLOSING: // then go to closed state
|
G_AddEvent(parent, EV_STASIS_DOOR_CLOSED, 0); // send event to client
|
||||||
G_AddEvent(ent, EV_STASIS_DOOR_CLOSED, 0); // send event to client
|
trap_LinkEntity(parent); // link entity again
|
||||||
trap_LinkEntity(ent); // link entity again
|
trap_AdjustAreaPortalState(parent, qfalse); // close AP
|
||||||
trap_AdjustAreaPortalState(ent, qfalse); // close AP
|
parent->count = STASIS_DOOR_CLOSED;
|
||||||
ent->count = STASIS_DOOR_CLOSED;
|
break;
|
||||||
break;
|
case STASIS_DOOR_OPENED: // then go to closing state
|
||||||
case STASIS_DOOR_OPENED: // then go to closing state
|
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_OPENED\n");
|
||||||
G_AddEvent(ent, EV_STASIS_DOOR_CLOSING, 0); // send event to client
|
G_AddEvent(parent, EV_STASIS_DOOR_CLOSING, 0); // send event to client
|
||||||
trap_UnlinkEntity(ent); // unlink entity
|
trap_UnlinkEntity(parent); // unlink entity
|
||||||
ent->count = STASIS_DOOR_CLOSING;
|
parent->count = STASIS_DOOR_CLOSING;
|
||||||
ent->nextthink = level.time + 1000;
|
parent->nextthink = level.time + 1000;
|
||||||
break;
|
break;
|
||||||
case STASIS_DOOR_OPENING: // then go to opened state
|
case STASIS_DOOR_OPENING: // then go to opened state
|
||||||
G_AddEvent(ent, EV_STASIS_DOOR_OPEN, 0); // send event to client
|
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_OPENING\n");
|
||||||
trap_AdjustAreaPortalState(ent, qtrue); // open AP
|
G_AddEvent(parent, EV_STASIS_DOOR_OPEN, 0); // send event to client
|
||||||
ent->count = STASIS_DOOR_OPENED;
|
trap_AdjustAreaPortalState(parent, qtrue); // open AP
|
||||||
break;
|
parent->count = STASIS_DOOR_OPENED;
|
||||||
}
|
break;
|
||||||
}
|
}*/
|
||||||
G_Printf( "^1Entity toggeling\n", 0 );
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
@ -3507,6 +3412,7 @@ will be called when the entity is used
|
||||||
|
|
||||||
void use_stasis_door(gentity_t *ent, gentity_t *other, gentity_t *activator)
|
void use_stasis_door(gentity_t *ent, gentity_t *other, gentity_t *activator)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
if(!Q_stricmp(activator->target, ent->targetname))
|
if(!Q_stricmp(activator->target, ent->targetname))
|
||||||
{
|
{
|
||||||
ent->think = toggle_stasis_door;
|
ent->think = toggle_stasis_door;
|
||||||
|
@ -3514,10 +3420,9 @@ void use_stasis_door(gentity_t *ent, gentity_t *other, gentity_t *activator)
|
||||||
}
|
}
|
||||||
else if(!Q_stricmp(activator->target, ent->swapname))
|
else if(!Q_stricmp(activator->target, ent->swapname))
|
||||||
{
|
{
|
||||||
ent->think = locked_stasis_door;
|
//ent->think = locked_stasis_door;
|
||||||
ent->nextthink = level.time + 50;
|
ent->nextthink = level.time + 100;
|
||||||
}
|
}
|
||||||
G_Printf( "^1Entity used\n", 0 );
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
@ -3530,14 +3435,14 @@ triggers the door on touch
|
||||||
|
|
||||||
void touch_stasis_door( gentity_t *ent, gentity_t *other, trace_t *trace )
|
void touch_stasis_door( gentity_t *ent, gentity_t *other, trace_t *trace )
|
||||||
{
|
{
|
||||||
|
|
||||||
// The door is solid so it's ok to open it, otherwise,
|
// The door is solid so it's ok to open it, otherwise,
|
||||||
// the door is already open and we don't need to bother with the state change
|
// the door is already open and we don't need to bother with the state change
|
||||||
if ( other->parent->count == 1 )
|
if ( other->client && ent->parent->count == STASIS_DOOR_CLOSED )
|
||||||
{
|
{
|
||||||
ent->think = toggle_stasis_door;
|
ent->think = toggle_stasis_door;
|
||||||
ent->nextthink = level.time + 50;
|
ent->nextthink = level.time + 50;
|
||||||
}
|
}
|
||||||
G_Printf( "^1Entity touched\n", 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3554,10 +3459,12 @@ void spawn_trigger_stasis_door( gentity_t *ent ) {
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
int i, best;
|
int i, best;
|
||||||
|
|
||||||
if (ent->wait == -1) return;
|
if(!ent) return;
|
||||||
|
|
||||||
// prevent me from thinking again
|
// set all of the slaves as shootable
|
||||||
ent->nextthink = -1;
|
for ( other = ent ; other ; other = other->teamchain ) {
|
||||||
|
other->takedamage = qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
// find the bounds of everything on the team
|
// find the bounds of everything on the team
|
||||||
VectorCopy (ent->r.absmin, mins);
|
VectorCopy (ent->r.absmin, mins);
|
||||||
|
@ -3575,11 +3482,12 @@ void spawn_trigger_stasis_door( gentity_t *ent ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maxs[best] += 128;
|
maxs[best] += 128;
|
||||||
mins[best] -= 128;
|
mins[best] -= 128;
|
||||||
|
|
||||||
// create a trigger with this size
|
// create a trigger with this size
|
||||||
other = G_Spawn ();
|
other = G_Spawn ();
|
||||||
|
G_SetOrigin(other, ent->s.origin);
|
||||||
VectorCopy (mins, other->r.mins);
|
VectorCopy (mins, other->r.mins);
|
||||||
VectorCopy (maxs, other->r.maxs);
|
VectorCopy (maxs, other->r.maxs);
|
||||||
other->parent = ent;
|
other->parent = ent;
|
||||||
|
@ -3587,7 +3495,8 @@ void spawn_trigger_stasis_door( gentity_t *ent ) {
|
||||||
other->touch = touch_stasis_door;
|
other->touch = touch_stasis_door;
|
||||||
|
|
||||||
trap_LinkEntity (other);
|
trap_LinkEntity (other);
|
||||||
G_Printf( "^1Spawnage complete\n", 0 );
|
|
||||||
|
ent->count = STASIS_DOOR_CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
@ -3621,7 +3530,7 @@ void SP_func_stasis_door( gentity_t *ent )
|
||||||
ent->nextthink = level.time + 50 * 5; // give the target a chance to spawn in
|
ent->nextthink = level.time + 50 * 5; // give the target a chance to spawn in
|
||||||
|
|
||||||
ent->use = use_stasis_door;
|
ent->use = use_stasis_door;
|
||||||
ent->count = 1;
|
ent->count = -1;
|
||||||
if (!ent->wait)
|
if (!ent->wait)
|
||||||
{
|
{
|
||||||
ent->wait = 5;
|
ent->wait = 5;
|
||||||
|
@ -3640,6 +3549,4 @@ void SP_func_stasis_door( gentity_t *ent )
|
||||||
G_AddEvent(ent, EV_STASIS_DOOR_SETUP, 0);
|
G_AddEvent(ent, EV_STASIS_DOOR_SETUP, 0);
|
||||||
|
|
||||||
trap_LinkEntity (ent);
|
trap_LinkEntity (ent);
|
||||||
|
|
||||||
G_Printf( "^1Spawnage in progress\n", 0 );
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Current version of holomatch game
|
// Current version of holomatch game
|
||||||
|
|
||||||
#define Q3_VERSION "RPG-X v2.2 wc121211a"
|
#define Q3_VERSION "RPG-X v2.2 wc121211b"
|
||||||
|
|
||||||
// end
|
// end
|
||||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue