func_stasis_door

Worked on func_stasis_door ... as it is now it'll crash the game :P
This commit is contained in:
Walter Julius Hennecke 2011-12-13 13:05:06 +01:00
parent d0c367a557
commit 1236ad50b4
8 changed files with 52 additions and 39 deletions

View file

@ -316,8 +316,8 @@ qboolean BorgBoltFirebackSparks( localEntity_t *le)
void CG_Bolt( centity_t *cent ) void CG_Bolt( centity_t *cent )
{ {
localEntity_t *le = NULL; localEntity_t *le = NULL;
qboolean bSparks = cent->currentState.eventParm & BOLT_SPARKS; qboolean bSparks = (qboolean)(cent->currentState.eventParm & BOLT_SPARKS);
qboolean bBorg = cent->currentState.eventParm & BOLT_BORG; qboolean bBorg = (qboolean)(cent->currentState.eventParm & BOLT_BORG);
float radius = cent->currentState.angles2[0], chaos = cent->currentState.angles2[1]; float radius = cent->currentState.angles2[0], chaos = cent->currentState.angles2[1];
float delay = cent->currentState.time2 * 1000; // the value given by the designer is in seconds float delay = cent->currentState.time2 * 1000; // the value given by the designer is in seconds
qboolean bRandom = qfalse; qboolean bRandom = qfalse;
@ -2049,7 +2049,7 @@ void CG_ShimmeryThing( vec3_t start, vec3_t end, vec3_t content )
AngleVectors( angles, NULL, dir, NULL ); AngleVectors( angles, NULL, dir, NULL );
// See if the effect should be tapered at the top // See if the effect should be tapered at the top
if ( taper = 2 ) if ( taper == 2 )
{ {
VectorMA( start, content[1] * 0.25f, dir, top ); VectorMA( start, content[1] * 0.25f, dir, top );
} }
@ -2154,3 +2154,28 @@ Yellow bolts that spark when the endpoints get close together
} }
}*/ }*/
void CG_StasisDoor(centity_t *cent, qboolean close) {
localEntity_t *le;
memset(&le->refEntity, 0, sizeof(le->refEntity));
CG_Printf("%f %f %f\n", cent->currentState.origin[0],
cent->currentState.origin[1],
cent->currentState.origin[2]);
FX_AddQuad(cent->currentState.origin, NULL, 10, 100, 1, 1, 0, 1000, cgs.media.photonGlow);
le = CG_AllocLocalEntity();
le->leType = LE_STASISDOOR;
VectorCopy(cent->lerpOrigin, le->refEntity.origin);
VectorCopy(cent->lerpOrigin, le->refEntity.oldorigin);
AnglesToAxis( cent->lerpAngles, le->refEntity.axis );
le->refEntity.renderfx = RF_NOSHADOW | RF_FORCE_ENT_ALPHA;
le->refEntity.skinNum = 0;
le->refEntity.hModel = cgs.media.stasisDoorModel;
trap_R_AddRefEntityToScene(&le->refEntity);
}

View file

@ -1764,29 +1764,18 @@ case EV_SHAKE_SOUND:
//CG_FireLaser( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles, cent->currentState.angles2, cent->currentState.scale); //CG_FireLaser( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles, cent->currentState.angles2, cent->currentState.scale);
break; break;
case EV_STASIS_DOOR_SETUP:
DEBUGNAME("EV_STASIS_DOOR_SETUP");
// setup model ....
break;
case EV_STASIS_DOOR_CLOSED:
DEBUGNAME("EV_STASIS_DOOR_CLOSED");
// set alpha and shader of model
break;
case EV_STASIS_DOOR_CLOSING: case EV_STASIS_DOOR_CLOSING:
DEBUGNAME("EV_STASIS_DOOR_CLOSING"); DEBUGNAME("EV_STASIS_DOOR_CLOSING");
CG_Printf("EV_STASIS_DOOR_CLOSING\n");
// do alpha fade, play sound // do alpha fade, play sound
break; CG_StasisDoor(cent, qtrue);
case EV_STASIS_DOOR_OPEN:
DEBUGNAME("EV_STASIS_DOOR_OPEN");
// make invisible
break; break;
case EV_STASIS_DOOR_OPENING: case EV_STASIS_DOOR_OPENING:
DEBUGNAME("EV_STASIS_DOOR_OPENING"); DEBUGNAME("EV_STASIS_DOOR_OPENING");
CG_Printf("EV_STASIS_DOOR_OPENING\n");
// do inverse alpha fade, play sound // do inverse alpha fade, play sound
CG_StasisDoor(cent, qfalse);
break; break;
// Additional ports from SP by Harry Young // Additional ports from SP by Harry Young

View file

@ -431,7 +431,8 @@ typedef enum {
LE_ELECTRICITY, LE_ELECTRICITY,
LE_PARTICLE, LE_PARTICLE,
LE_SPAWNER, LE_SPAWNER,
LE_FRAGMENT LE_FRAGMENT,
LE_STASISDOOR
} leType_t; } leType_t;
typedef enum { typedef enum {
@ -1366,6 +1367,9 @@ typedef struct {
//hazard Helmet //hazard Helmet
qhandle_t hazardHelmet; qhandle_t hazardHelmet;
// stasis door model
qhandle_t stasisDoorModel;
// sounds // sounds
//sfxHandle_t quadSound; //sfxHandle_t quadSound;
//sfxHandle_t selectSound; //sfxHandle_t selectSound;
@ -2042,11 +2046,7 @@ void CG_Drip(centity_t *cent, int killTime );
void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type ); void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type );
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, float alpha ); void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, float alpha );
void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal ); void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal );
// Stasis_door-stuff void CG_StasisDoor(centity_t *cent, qboolean close);
// Stasis_door-stuff
// Stasis_door-stuff
// Stasis_door-stuff
// Stasis_door-stuff
//TiM //TiM
void CG_FountainSpurt( vec3_t org, vec3_t end ); void CG_FountainSpurt( vec3_t org, vec3_t end );

View file

@ -1300,6 +1300,15 @@ void CG_AddLocalEntities( void ) {
case LE_FRAGMENT: case LE_FRAGMENT:
CG_AddFragment(le); CG_AddFragment(le);
break; break;
case LE_STASISDOOR:
if(le->refEntity.data.cylinder.wrap) {
le->refEntity.shaderRGBA[3] = (1 - (le->endTime - cg.time)/1000) * 255;
} else {
le->refEntity.shaderRGBA[3] = ((le->endTime - cg.time)/1000) * 255;
}
trap_R_AddRefEntityToScene(&le->refEntity);
break;
} }
} }
} }

View file

@ -1156,6 +1156,9 @@ static void CG_RegisterGraphics( void ) {
cgs.media.medicalScanner = trap_R_RegisterModel( "models/weapons2/tricorder/tricorder_scanner.md3" ); cgs.media.medicalScanner = trap_R_RegisterModel( "models/weapons2/tricorder/tricorder_scanner.md3" );
cgs.media.hazardHelmet = trap_R_RegisterModel( "models/boltOns/helmet.md3" ); cgs.media.hazardHelmet = trap_R_RegisterModel( "models/boltOns/helmet.md3" );
//Stasis Door
cgs.media.stasisDoorModel = trap_R_RegisterModel( "models/mapobjects/stasis/door.md3" );
//RPG-X START | GSIO01 | 09/05/2009 | START //RPG-X START | GSIO01 | 09/05/2009 | START
switch(rpg_forceFieldSet.integer) { switch(rpg_forceFieldSet.integer) {
case 2: case 2:

View file

@ -878,11 +878,8 @@ typedef enum {
EV_LASERTURRET_AIM, EV_LASERTURRET_AIM,
EV_LASERTURRET_FIRE, EV_LASERTURRET_FIRE,
EV_STASIS_DOOR_SETUP,
EV_STASIS_DOOR_OPENING, EV_STASIS_DOOR_OPENING,
EV_STASIS_DOOR_OPEN,
EV_STASIS_DOOR_CLOSING, EV_STASIS_DOOR_CLOSING,
EV_STASIS_DOOR_CLOSED
} entity_event_t; } entity_event_t;
/* THIS IS OLD FROM HOLOMATCH (RPG-X: J2J) /* THIS IS OLD FROM HOLOMATCH (RPG-X: J2J)

View file

@ -3370,22 +3370,19 @@ void toggle_stasis_door( gentity_t *ent )
ent->nextthink = -1; // prevent thinking again until this think is finished ent->nextthink = -1; // prevent thinking again until this think is finished
switch(parent->count) { switch(parent->count) {
case STASIS_DOOR_CLOSED: // then go to opening state case STASIS_DOOR_CLOSED: // then go to opening state
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSED\n");
G_AddEvent(parent, EV_STASIS_DOOR_OPENING, 0); // send event to client G_AddEvent(parent, EV_STASIS_DOOR_OPENING, 0); // send event to client
parent->r.svFlags |= SVF_NOCLIENT; //parent->r.svFlags |= SVF_NOCLIENT;
parent->s.eFlags |= EF_NODRAW; parent->s.eFlags |= EF_NODRAW;
parent->count = STASIS_DOOR_OPENING; parent->count = STASIS_DOOR_OPENING;
ent->nextthink = level.time + 1000; ent->nextthink = level.time + 1000;
trap_LinkEntity(parent); trap_LinkEntity(parent);
break; break;
case STASIS_DOOR_CLOSING: // then go to closed state case STASIS_DOOR_CLOSING: // then go to closed state
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_CLOSING\n");
G_AddEvent(parent, EV_STASIS_DOOR_CLOSED, 0); // setnd event to client
trap_SetBrushModel(parent, parent->model); trap_SetBrushModel(parent, parent->model);
InitMover( parent ); InitMover( parent );
VectorCopy( parent->s.origin, parent->s.pos.trBase ); VectorCopy( parent->s.origin, parent->s.pos.trBase );
VectorCopy( parent->s.origin, parent->r.currentOrigin ); VectorCopy( parent->s.origin, parent->r.currentOrigin );
parent->r.contents &= ~SVF_NOCLIENT; //parent->r.contents &= ~SVF_NOCLIENT;
parent->s.eFlags &= ~EF_NODRAW; parent->s.eFlags &= ~EF_NODRAW;
trap_AdjustAreaPortalState(parent, qfalse); // close AP trap_AdjustAreaPortalState(parent, qfalse); // close AP
trap_LinkEntity(parent); trap_LinkEntity(parent);
@ -3393,7 +3390,6 @@ void toggle_stasis_door( gentity_t *ent )
ent->touch = touch_stasis_door; ent->touch = touch_stasis_door;
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(parent, EV_STASIS_DOOR_CLOSING, 0); // send event to client G_AddEvent(parent, EV_STASIS_DOOR_CLOSING, 0); // send event to client
parent->r.contents = CONTENTS_SOLID; parent->r.contents = CONTENTS_SOLID;
parent->count = STASIS_DOOR_CLOSING; parent->count = STASIS_DOOR_CLOSING;
@ -3401,8 +3397,6 @@ void toggle_stasis_door( gentity_t *ent )
trap_LinkEntity(parent); trap_LinkEntity(parent);
break; break;
case STASIS_DOOR_OPENING: // then go to opened state case STASIS_DOOR_OPENING: // then go to opened state
G_Printf(S_COLOR_MAGENTA"STASIS_DOOR_OPENING\n");
G_AddEvent(parent, EV_STASIS_DOOR_OPEN, 0); // send event to client
parent->r.contents = CONTENTS_NONE; parent->r.contents = CONTENTS_NONE;
trap_AdjustAreaPortalState(parent, qtrue); // open AP trap_AdjustAreaPortalState(parent, qtrue); // open AP
trap_LinkEntity(parent); trap_LinkEntity(parent);
@ -3445,8 +3439,6 @@ 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 )
{ {
G_Printf("touch_stasis_door\n");
// 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 (ent->parent->count == STASIS_DOOR_CLOSED) if (ent->parent->count == STASIS_DOOR_CLOSED)
@ -3557,8 +3549,6 @@ void SP_func_stasis_door( gentity_t *ent )
// copy mins and max for client side model // copy mins and max for client side model
VectorCopy(ent->r.maxs, ent->s.origin2); VectorCopy(ent->r.maxs, ent->s.origin2);
VectorCopy(ent->r.mins, ent->s.angles2); VectorCopy(ent->r.mins, ent->s.angles2);
// setup event
G_AddEvent(ent, EV_STASIS_DOOR_SETUP, 0);
trap_LinkEntity (ent); trap_LinkEntity (ent);
} }

Binary file not shown.