Started to add HUD-Element for Selfdestruct, however...

there seems to be an issue with the way I selected to transfer the countdown duration to the client (via event)
In server side Execution I run by the g_addevent just fine, however on the client side the event is not called.

there is also a new definition for trigger_airlock.

Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
Harry Young 2012-12-06 15:52:34 +01:00
parent 1953cfaa25
commit cc4b48e8fa
6 changed files with 110 additions and 1 deletions

View file

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

View file

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

View file

@ -1493,6 +1493,13 @@ typedef struct {
char scannableStrings[MAX_SCANNABLES][36];
qboolean scannablePanels;
// selfdestruct
int selfdestructTime;
// shiphealth
int relativeHullStrength;
int relativeShieldStrength;
} cgs_t;
//==============================================================================

View file

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

View file

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

View file

@ -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;
*/