diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index 3bb58a0..6155eb9 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -1830,6 +1830,38 @@ CENTER PRINTING =============================================================================== */ +/* +================= +CG_DrawSelfdestructTimer +================= +*/ +static float CG_DrawSelfdestructTimer( void ) { + char *s; + int w; + int mins, tens, seconds, remainder; + int msec; + + msec = cgs.selfdestructTime - cg.time; + //msec = 0; + + if (msec < 1) + return 0; + + mins = msec / 60000; + tens = (msec - (mins * 60000)) / 10000; + seconds = (msec - (mins * 60000) - (tens * 10000)) / 1000; + remainder = msec - (mins * 60000) - (tens * 10000) - (seconds * 1000); + + s = va( "%i:%i%i.%i", mins, tens, seconds, remainder ); + + w = UI_ProportionalStringWidth("SELF-DESTRTUCT IN",UI_SMALLFONT); + UI_DrawProportionalString(320 - (w / 2), 10, "SELF-DESTRTUCT IN", UI_SMALLFONT, colorTable[CT_RED]); + + w = UI_ProportionalStringWidth(s,UI_SMALLFONT); + UI_DrawProportionalString(320 - (w / 2), 30, s, UI_SMALLFONT, colorTable[CT_RED]); + + return 0; +} /* ============== @@ -3360,6 +3392,8 @@ static void CG_Draw2D( void ) { CG_DrawLowerLeft(); + CG_DrawSelfdestructTimer(); + //RPG-X | Phenix | 08/06/2005 cgs.widescreen.state = WIDESCREEN_CENTER; CG_DrawAdminMsg(); diff --git a/code/cgame/cg_event.c b/code/cgame/cg_event.c index 2d9f6f7..4848479 100644 --- a/code/cgame/cg_event.c +++ b/code/cgame/cg_event.c @@ -1824,6 +1824,37 @@ case EV_SHAKE_SOUND: FX_AddLine(cent->currentState.origin, cent->currentState.origin2, 0.5, 0.5, 0.5, 1.0, 1.0, 1000, cgs.media.laserShader); break; +// selfdestruct and shiphealth setter + + case EV_SELFDESTRUCT_SETTER: + DEBUGNAME("EV_SELFDESTRUCT_SETTER"); + trap_Print(va("cgs.selfdestructTime preset is %i", cgs.selfdestructTime)); + if(cent->currentState.eventParm == -1) + cgs.selfdestructTime = -1; + else + cgs.selfdestructTime = cent->currentState.eventParm + cg.time; + trap_Print(va("cgs.selfdestructTime postset is %i", cgs.selfdestructTime)); + + break; + + case EV_HULLHEALTH_SETTER: + DEBUGNAME("EV_HULLHEALTH_SETTER"); + if(cent->currentState.eventParm == -1) + cgs.relativeHullStrength = -1; + else + cgs.relativeHullStrength = cent->currentState.eventParm; + + break; + + case EV_SHIELDHEALTH_SETTER: + DEBUGNAME("EV_SHIELDHEALTH_SETTER"); + if(cent->currentState.eventParm == -1) + cgs.relativeShieldStrength = -1; + else + cgs.relativeShieldStrength = cent->currentState.eventParm; + + break; + // Default default: diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index 46e961a..ff5b960 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1493,6 +1493,13 @@ typedef struct { char scannableStrings[MAX_SCANNABLES][36]; qboolean scannablePanels; + + // selfdestruct + int selfdestructTime; + + // shiphealth + int relativeHullStrength; + int relativeShieldStrength; } cgs_t; //============================================================================== diff --git a/code/game/bg_public.h b/code/game/bg_public.h index 080ee34..5726ce7 100644 --- a/code/game/bg_public.h +++ b/code/game/bg_public.h @@ -799,7 +799,11 @@ typedef enum { EV_STASIS_DOOR_OPENING, EV_STASIS_DOOR_CLOSING, - EV_DEBUG_TRACE + EV_DEBUG_TRACE, + + EV_SELFDESTRUCT_SETTER, + EV_HULLHEALTH_SETTER, + EV_SHIELDHEALTH_SETTER } entity_event_t; //RPG-X: J2J - Moved animation enum list so that the string list can see it, Note special case for cg_players.c. diff --git a/code/game/g_target.c b/code/game/g_target.c index 2a84574..472b83a 100644 --- a/code/game/g_target.c +++ b/code/game/g_target.c @@ -2740,6 +2740,7 @@ void target_selfdestruct_use(gentity_t *ent, gentity_t *other, gentity_t *activa G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3")); //set wait to -1... ent->wait = -1; + G_AddEvent( ent, EV_SELFDESTRUCT_SETTER, -1 ); //and arrange for a think in a sec ent->nextthink = level.time + 1000; } @@ -2845,6 +2846,7 @@ void target_selfdestruct_think(gentity_t *ent) { //we have aborted and the note should be out or ended and everyone should be dead so let's reset ent->nextthink = -1; + G_AddEvent( ent, EV_SELFDESTRUCT_SETTER, -1 ); ent->wait = ent->splashDamage; //free ent if it was command-spawned if (ent->spawnflags & 1) @@ -2914,6 +2916,7 @@ void target_selfdestructcountdown_think(gentity_t *ent) { //we have aborted and the note should be out or ended and everyone should be dead so let's reset ent->nextthink = -1; + G_AddEvent( ent, EV_SELFDESTRUCT_SETTER, -1 ); ent->wait = ent->splashDamage; //free ent if it was command-spawned if (ent->spawnflags & 1) @@ -2949,6 +2952,9 @@ void SP_target_selfdestruct(gentity_t *ent) { ent->splashRadius = 1; } + trap_Printf(va("ent->wait pretransfer is %f", ent->wait)); + G_AddEvent( ent, EV_SELFDESTRUCT_SETTER, ent->wait ); + //we'll need to back up the total for a possible reset. ent->splashDamage = ent->wait; diff --git a/code/game/g_trigger.c b/code/game/g_trigger.c index 9652902..0586582 100644 --- a/code/game/g_trigger.c +++ b/code/game/g_trigger.c @@ -1164,3 +1164,30 @@ void SP_trigger_radiation(gentity_t *ent) { level.numBrushEnts++; } +/*QUAKED trigger_airlock (0.5 0.5 0.5) ? +-----DESCRIPTION----- +This is an entity that manages airlocks. +It can be used for Maintenance-Locks (Space Walks) internal Airlocks (for example to a quarantene zone) +or... as a way to abandon ship the hard way ^^ In that last case even an EVA-Suit won't protect you. + +It is controlled by User Interface. + +The Entity automatically features door management in a cycle, a check for an EVA-Suit (trigger_hurt) +and a push to get overboard (trigger_push). + +It is hardcoded to expect func_doors for entrance on either side and a func_forcefiled for ejecting +(the forcefield is best placed within the outer door). + +For Setup please set both sets of doors to wait = -1 and have the inner (if you select spawnflag no. 1 +the outer) door spawn in it's open state. + +-----SPAWNFLAGS----- +1: START_OUTSIDE - assumes that the outside door is open and set's itself up approopriately to cycle in at first use +2: NO_VENT - Will not check for push-target and forcefield that are required to vent the airlock. +4: QUARTANTENE_LOCK - airlock will be considered as an internal airlock to a quarantene zone or similar. + this will not kill and will not check for ejection-stuff, so NO_VENT is included in this spawnflag. + +-----KEYS----- +"wait" time to wait before trigger gets deactivated again(in seconds, default 5) +"soundstart" transport sound; +*/ \ No newline at end of file