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:
Walter Julius Hennecke 2011-12-12 23:59:32 +01:00
parent f6b13eb6c4
commit 43bd3c87dc
5 changed files with 53 additions and 146 deletions

View file

@ -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 $<

View file

@ -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);

View file

@ -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) {
{
ent->think = toggle_stasis_door;
switch(ent->count) {
case STASIS_DOOR_CLOSED: // then go to opening state case STASIS_DOOR_CLOSED: // then go to opening state
G_AddEvent(ent, EV_STASIS_DOOR_OPENING, 0); // send event to client G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSED\n");
ent->count = STASIS_DOOR_OPENING; G_AddEvent(parent, EV_STASIS_DOOR_OPENING, 0); // send event to client
ent->nextthink = level.time + 1000; parent->count = STASIS_DOOR_OPENING;
parent->nextthink = level.time + 1000;
break; break;
case STASIS_DOOR_CLOSING: // then go to closed state case STASIS_DOOR_CLOSING: // then go to closed state
G_AddEvent(ent, EV_STASIS_DOOR_CLOSED, 0); // send event to client G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSING\n");
trap_LinkEntity(ent); // link entity again G_AddEvent(parent, EV_STASIS_DOOR_CLOSED, 0); // send event to client
trap_AdjustAreaPortalState(ent, qfalse); // close AP trap_LinkEntity(parent); // link entity again
ent->count = STASIS_DOOR_CLOSED; trap_AdjustAreaPortalState(parent, qfalse); // close AP
parent->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_AddEvent(ent, EV_STASIS_DOOR_CLOSING, 0); // send event to client G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_OPENED\n");
trap_UnlinkEntity(ent); // unlink entity G_AddEvent(parent, EV_STASIS_DOOR_CLOSING, 0); // send event to client
ent->count = STASIS_DOOR_CLOSING; trap_UnlinkEntity(parent); // unlink entity
ent->nextthink = level.time + 1000; parent->count = STASIS_DOOR_CLOSING;
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
parent->count = STASIS_DOOR_OPENED;
break; 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);
@ -3580,6 +3487,7 @@ void spawn_trigger_stasis_door( gentity_t *ent ) {
// 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 );
} }

View file

@ -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

Binary file not shown.