Merge pull request #28 from ScatterBox/main

Restore svc_songegg and svc_maxammo in Quakespasm
This commit is contained in:
Ian 2023-01-24 16:35:27 -05:00 committed by GitHub
commit 0e2b8a616d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 134 additions and 8 deletions

View file

@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "bgmusic.h"
extern qboolean domaxammo;
const char *svc_strings[] =
{
"svc_bad",
@ -80,8 +82,8 @@ const char *svc_strings[] =
"svc_spawnbaseline2", //42 // support for large modelindex, large framenum, alpha, using flags
"svc_spawnstatic2", // 43 // support for large modelindex, large framenum, alpha, using flags
"svc_spawnstaticsound2", // 44 // [coord3] [short] samp [byte] vol [byte] aten
"", // 45
"", // 46
"svc_songegg", // 45
"svc_maxammo", // 46
"", // 47
"", // 48
"", // 49
@ -90,7 +92,6 @@ const char *svc_strings[] =
"svc_achievement", // 52
"svc_updatekills" // 53
//johnfitz
};
@ -1534,6 +1535,10 @@ void CL_ParseServerMessage (void)
case svc_achievement:
HUD_Parse_Achievement (MSG_ReadByte());
break;
case svc_maxammo:
domaxammo = true;
break;
//case svc_bspdecal:
// CL_ParseBSPDecal ();

View file

@ -65,6 +65,7 @@ float round_center_x;
float round_center_y;
extern qboolean paused_hack;
qboolean domaxammo;
double HUD_Change_time;//hide hud when not chagned
@ -532,7 +533,25 @@ void HUD_Blood (void)
GL_SetCanvas(CANVAS_USEPRINT);
}
//=============================================================================
/*
===============
HUD_MaxAmmo
===============
*/
int maxammoy;
int maxammoopac;
void HUD_MaxAmmo(void)
{
maxammoy -= cl.time * 0.003;
maxammoopac -= 5;
Draw_ColoredStringScale(vid.width/2 - strlen("MAX AMMO!")*16, maxammoy, "MAX AMMO!", 255, 255, 255, maxammoopac, 2.0f);
if (maxammoopac <= 0) {
domaxammo = false;
}
}
/*
===============
@ -579,12 +598,12 @@ void HUD_Rounds (void)
#ifdef VITA
Draw_ColorStretchPic (round_center_x, round_center_y, stretch_x, stretch_y, sb_round[0], 0.4196, 0.004, 0, 1);
round_center_x = round_center_x - ((229/108)*2 - 0.2)*(vid.width/2)/480;
round_center_y = round_center_y + ((vid.height*1.015)/272);
round_center_x = round_center_x - ((229/108)*2 - 0.2)*(vid.width/2)/850;
round_center_y = round_center_y + ((vid.height*1.015)/2);
if (round_center_x <= 5)
round_center_x = 5;
if (round_center_y >= 250*vid.height/272)
round_center_y = 250*vid.height/272;
if (round_center_y >= 250*vid.height/340)
round_center_y = 250*vid.height/340;
#else
Draw_ColorPic (round_center_x, round_center_y, sb_round[0], 0.4196, 0.004, 0, 1);
@ -1703,6 +1722,13 @@ void HUD_Draw (void) {
/*
HUD_Achievement();
*/
if (domaxammo == true) {
if (maxammoopac <= 0) {
maxammoopac = 255;
maxammoy = 100;
}
HUD_MaxAmmo();
}
GL_SetCanvas(CANVAS_DEFAULT);
}

View file

@ -1246,6 +1246,39 @@ static void PF_Remove (void)
ED_Free (ed);
}
/*
=================
PF_SongEgg
plays designated easter egg track
songegg(trackname)
=================
*/
void PF_SongEgg (void)
{
char trackname;
trackname = G_STRING(OFS_PARM0);
MSG_WriteByte (&sv.reliable_datagram, svc_songegg);
MSG_WriteString (&sv.reliable_datagram, trackname);
}
/*
=================
PF_MaxAmmo
activates max ammo text in HUD
nzp_maxammo()
=================
*/
void PF_MaxAmmo(void)
{
MSG_WriteByte(&sv.reliable_datagram, svc_maxammo);
}
/*
=================
PF_achievement
@ -3679,6 +3712,65 @@ static builtin_t pr_builtin[] =
NULL, // #440
PF_tokenize, // #441
PF_ArgV, // #442
NULL, // #443
NULL, // #444
NULL, // #445
NULL, // #446
NULL, // #447
NULL, // #448
NULL, // #449
NULL, // #450
NULL, // #451
NULL, // #452
NULL, // #453
NULL, // #454
NULL, // #455
NULL, // #456
NULL, // #457
NULL, // #458
NULL, // #459
NULL, // #460
NULL, // #461
NULL, // #462
NULL, // #463
NULL, // #464
NULL, // #465
NULL, // #466
NULL, // #467
NULL, // #468
NULL, // #469
NULL, // #470
NULL, // #471
NULL, // #472
NULL, // #473
NULL, // #474
NULL, // #475
NULL, // #476
NULL, // #477
NULL, // #478
NULL, // #479
NULL, // #480
NULL, // #481
NULL, // #482
NULL, // #483
NULL, // #484
NULL, // #485
NULL, // #486
NULL, // #487
NULL, // #488
NULL, // #489
NULL, // #490
NULL, // #491
NULL, // #492
NULL, // #493
NULL, // #494
NULL, // #495
NULL, // #496
NULL, // #497
NULL, // #498
NULL, // #499
PF_SongEgg, // #500
PF_MaxAmmo, // #501
};
builtin_t *pr_builtins = pr_builtin;

View file

@ -212,6 +212,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_spawnstaticsound2 44 // [coord3] [short] samp [byte] vol [byte] aten
//johnfitz
#define svc_songegg 45 // 45
#define svc_maxammo 46 // 46
#define svc_limbupdate 51
#define svc_achievement 52 // [string] name [byte] decal_size [coords] pos
#define svc_updatekills 53 // [string] to put in center of the screen