CLIENT/SERVER: Tweak Game Over sequencing

This commit is contained in:
cypress 2023-12-28 11:28:45 -05:00
parent 8c362579b7
commit e5372d3107
7 changed files with 32 additions and 16 deletions

View file

@ -319,7 +319,7 @@ void(float width, float height) HUD_Points =
float player_number = getplayerkeyfloat(i, "viewentity");
entity client = findfloat(world, playernum, player_number);
if (client == world || client.movetype == MOVETYPE_TOSS)
if (client == world || client.movetype == MOVETYPE_BOUNCE)
continue;
switch(i) {
@ -1398,7 +1398,7 @@ void() HUD_Scores =
float player_number = getplayerkeyfloat(i, "viewentity");
entity client = findfloat(world, playernum, player_number);
if (client == world || client.movetype == MOVETYPE_TOSS)
if (client == world || client.movetype == MOVETYPE_BOUNCE)
break;
switch(i) {
@ -1744,7 +1744,7 @@ void(float width, float height) HUD_Draw =
if (broadcast_time > time)
HUD_Broadcast();
if (getstatf(STAT_HEALTH) <= 10 && getstatf(STAT_SPECTATING) && !find(world, classname, "ai_zombie"))
if (game_over)
HUD_Endgame();
if (score_show)

View file

@ -563,7 +563,7 @@ noref void(float isnew) CSQC_Ent_Update =
RegisterPointChange(self.points - old_points, self.playernum);
if (self.movetype == MOVETYPE_TOSS)
if (self.movetype == MOVETYPE_BOUNCE)
self.solid = SOLID_NOT;
else
self.solid = SOLID_SLIDEBOX;
@ -1384,7 +1384,9 @@ noref void() CSQC_Parse_Event =
useprint_time = time + 0.1;
break;
case EVENT_ENDGAME:
game_over = true;
break;
case EVENT_NEWROUND:
rounds = readbyte();
HUD_Change_time = time + 6;

View file

@ -26,6 +26,17 @@
*/
string(string asset) convert_old_asset_path;
void() NotifyGameEnd =
{
#ifdef FTE
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EVENT_ENDGAME);
multicast('0 0 0', MULTICAST_ALL);
#endif // FTE
}
void SetUpdate(entity client, float type, float val1, float val2, float val3)
{
#ifdef FTE

View file

@ -63,7 +63,6 @@ void() EndGame =
self.origin = '0 0 0';
setorigin (self, self.origin);
self.velocity = '0 0 0';
sound (self, CHAN_AUTO, "sounds/music/end.wav", 1, ATTN_NORM);
oldself = self;
@ -81,7 +80,7 @@ void() EndGame =
}
self.think = EndGame_FadePrompt;
self.nextthink = time + 33;
self.nextthink = time + 28;
}
// when dead and other players exist and are alive, throw user into spectate mode
@ -99,8 +98,6 @@ void() startspectate =
self.downedloop = 0;
self.beingrevived = false;
self.model = "";
setmodel(self, self.model);
self.health = 100;
self.weaponmodel = "";
self.weapon2model = "";
@ -132,10 +129,9 @@ float() PollPlayersAlive =
// Endgamesetup -- think function for setting up the death of everyone
void() EndGameSetup =
{
game_over = true;
self.health = 10;
self.think = EndGame;
self.nextthink = time + 5;
self.nextthink = time + 4;
self.weapon = 0;
self.currentammo = 0;
self.currentmag = 0;
@ -144,6 +140,12 @@ void() EndGameSetup =
self.animend = SUB_Null;
self.perks = 0;
self.isspec = true;
if (!game_over) {
sound(self, CHAN_AUTO, "sounds/music/end.wav", 1, ATTN_NONE);
NotifyGameEnd();
}
game_over = true;
SetPerk(self, self.perks);
SwitchWeapon(0);
addmoney(self, -self.points, 0);

View file

@ -484,7 +484,6 @@ float Remaining_Zombies;
float Delay_Time;
float spawn_time;
float round_changetime;
float game_over;
float blink_return;
float delay_at_round;
float spawn_delay;

View file

@ -848,13 +848,13 @@ void() PlayerSpawn =
void() SpectatorSpawn =
{
local entity spawnpoint;
spawnpoint = find(world, classname, "info_player_start");
spawnpoint = find(world, classname, "info_player_1_spawn");
self.isspec = TRUE;
self.health = 420;
self.classname = "spectator";
self.solid = SOLID_NOT;
setmodel(self, "");
self.solid = SOLID_CORPSE;
setmodel(self, "models/sprites/null.spr");
self.movetype = MOVETYPE_FLY;
self.origin = spawnpoint.origin + [0,0,1];
self.fixangle = TRUE;
@ -901,7 +901,7 @@ void() ClientDisconnect =
self.classname = "disconnected";
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.movetype = MOVETYPE_BOUNCE;
self.nextthink = -1;
setmodel(self, "models/sprites/null.spr");

View file

@ -61,6 +61,7 @@ const float EVENT_LIMBGIB = 44;
const float EVENT_CHATMESSAGE = 45;
const float EVENT_DOUBLETAPUPDATE = 46;
const float EVENT_FLAME = 47;
const float EVENT_ENDGAME = 48;
// Define our FTE platform
#ifndef STANDARD
@ -241,6 +242,7 @@ const float EVENT_FLAME = 47;
#define STAT_PLAYERNAME 68
.float playernum;
float game_over;
//
// invert float takes in float value between 0 and 1, inverts position