Compare commits

...
27 Commits
Author SHA1 Message Date
indev 15bb99d27d Use case insensitive string hashing and compare functions for cvar hashtable 2026-04-09 19:56:32 +02:00
alufolie91 7fb21c35ba Experiment: speed up CV_FindVar and CV_FindNetVar
oftentimes lua scripts call CV_FindVar a fuckton of times during runtime, with many cvars this can actually tank performance more than one might think
ideally lua scripts should cache the result, but with so much stuff and servers we cant expect everyone to go through all scripts to do that
using a hashtable for CV_FindNetVar might improve join times aswell, but needs further testing to confirm
2026-03-25 19:35:20 +01:00
alufolie91 f6a0430a40 use constructor for W_Startup
never liked having this inside i_system
2026-03-25 19:35:17 +01:00
alufolie91 ab209448d1 Introduce GNU constructor and destructor attributes
The constructor attribute causes the function to be called automatically before execution enters main (). Similarly, the destructor attribute causes the function to be called automatically after main () has completed or exit () has been called. Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program.

added "used" attribute aswell so compiler does not omit non referenced functions (i hope)
gotta test this a bit but seems cool for stuff like verstable maps
2026-03-25 19:35:14 +01:00
alufolie91 9334b86f6e console print for playing demos from replayhut
might be useful
perhaps this should be put into g_doplaydemo instead?
2026-03-25 19:34:56 +01:00
alufolie91 6022966d69 G_DoPlayDemo: fix demoname becoming garbage when replay restarts/rewinds
only used in the error paths, which we shouldnt reach
but im not a fan of having a chance of putting garbo in the console
2026-03-25 19:34:54 +01:00
indev 6c7db705c7 Strip colors from demo titles for replay search 2026-03-25 21:05:39 +03:00
indev ce3d17de68 Simplify R_DoPlayerFade crash fix a bit and rename playerdist to otherplayerdist 2026-03-25 20:24:37 +03:00
alufolie91 404d88a536 remove some dead code 2026-03-24 01:07:07 +01:00
indev 4f28f574bb Fix rare crash in R_DoPlayerFade when viewplayerdist is too low 2026-03-24 00:20:28 +03:00
alufolie91 654895dcff fix timedemo not accounting for level and addon loading
apparently demos used to send a mapcmd before instead of directly calling G_InitNew, so this function was never called which meant that timedemos always returned a wrong result first time
2026-03-23 19:05:37 +01:00
alufolie91 8af43a55c9 split CONS_Printf
so both CONS_Alert and CONS_Debug dont have to handle and copy the varargs twice
probably makes no actual difference in practice, but i prefer it to not do pointless work
2026-03-22 22:29:21 +01:00
alufolie91 0d20ebb01f delet P_CyclePlayerMobjState
P_SetMobjState already handles player case and forwards it to P_SetPlayerMobjState
so this is just duped code
2026-03-22 22:17:45 +01:00
alufolie91 1c74b37026 unify console shift handling
both the non AZERTY and AZERTY functions basically did the exact same thing so can just get rid of one
also simplify some checks
2026-03-22 22:14:19 +01:00
indev 6721f534cc Fix Got_Saycmd not skipping null terminator when message has maximum length 2026-03-22 22:16:55 +03:00
indev bb3414d603 Fix /pm and emote suggestions overlapping 2026-03-21 23:10:48 +03:00
indev e13cb1ca92 Remove few remaining flashpal things in opengl menu 2026-03-17 19:00:38 +03:00
indev a0dffd0670 Fix listemotes calculating incorrect number of pages 2026-03-16 04:07:48 +03:00
Alug 9087fd8377 lua hooklib: use NUMMOBJTYPES to detect mobj hooks
removes the "force_mobj" field, gives a suprising perf boost from my timedemo testing +6-7fps (164 - 169/170fps)
this does however will prevent the generic hook from being called if the mobj being passed ever should be NULL
This shouldnt ever happen, vanilla assumes this aswell and way worse things would happen there, but just wanted to note
2026-03-13 19:09:38 +01:00
Alug 1aa37be676 p_user: cache kartspeed value within P_3dMovement
its result shouldnt change there, so no need to always recompute stuff, even if its not heavy work
2026-03-13 19:09:26 +01:00
Alug 04f63b23ff software: hack for bogus height walls
as per comment, this is merely a shitty workaround for a chain reaction of bad fixed point maths
since im honestly not feeling like rewriting most of the software renderer to either operate on 64bit or float maths, we just skip drawing anything that seems completely unreasonable
2026-03-13 19:09:18 +01:00
Alug d6ed923f83 P_XYMovement: check for kart specific stuff first to determine friction apply
this stuff is much more common than the other stuff being checked, so more likely to return earlier and save a bunch of other checks
2026-03-13 19:09:08 +01:00
Alug c7845118c0 explicitly cast those 2026-03-13 19:08:50 +01:00
alufolie91 ffc6adde4c Merge branch 'servaddonsonly' into Saturn-Next 2026-03-13 19:08:21 +01:00
Alug 00bc8bc149 limit addon only stuff to server info screen
quite honestly everything else is awful and i dont want to bother with it
2026-01-27 18:23:51 +01:00
Alug f12b55f63b rename addonsonly variable to cl_addonsonly
very generic name so add the prefix for whatever cl means
2026-01-27 18:08:12 +01:00
Alug 3e476d7658 implement allowing to load addons and gamestate only instead of joining server
really messy, needs some cleanup, not sure if this is good at all
2026-01-27 18:06:22 +01:00
34 changed files with 351 additions and 554 deletions

No files matched your search

+63 -1
View File
@@ -1165,6 +1165,39 @@ void VS_Print(vsbuf_t *buf, const char *data)
//
// =========================================================================
#define NAME cvar_map_t
#define KEY_TY const char *
#define VAL_TY consvar_t *
#define HASH_FN FNV1a_HashLowercaseString
#define CMPR_FN vt_cmpr_casestring
#include "verstable.h"
#define NAME netvar_map_t
#define KEY_TY UINT16
#define VAL_TY consvar_t *
#define HASH_FN vt_hash_integer
#define CMPR_FN vt_cmpr_integer
#include "verstable.h"
static cvar_map_t cvar_map;
static netvar_map_t netvar_map;
CONSTRUCTOR static void CV_InitMap(void)
{
// ensure the map is initialized
cvar_map_t_init(&cvar_map);
cvar_map_t_reserve(&cvar_map, 512);
netvar_map_t_init(&netvar_map);
netvar_map_t_reserve(&netvar_map, 256);
}
DESTRUCTOR static void CV_DestroyMap(void)
{
cvar_map_t_cleanup(&cvar_map);
netvar_map_t_cleanup(&netvar_map);
}
static const char *cv_null_string = "";
/** Searches if a variable has been registered.
@@ -1175,11 +1208,17 @@ static const char *cv_null_string = "";
*/
consvar_t *CV_FindVar(const char *name)
{
consvar_t *cvar;
cvar_map_t_itr it = cvar_map_t_get(&cvar_map, name);
if (!cvar_map_t_is_end(it))
return it.data->val;
// fallback linear search
/*
consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (fasticmp(name, cvar->name))
return cvar;
*/
return NULL;
}
@@ -1213,11 +1252,17 @@ static inline UINT16 CV_ComputeNetid(const char *s)
*/
static consvar_t *CV_FindNetVar(UINT16 netid)
{
netvar_map_t_itr it = netvar_map_t_get(&netvar_map, netid);
if (!netvar_map_t_is_end(it))
return it.data->val;
/*
consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (cvar->netid == netid)
return cvar;
*/
if (netid == 44542) // ouch this hack
return &cv_karteliminatelast;
@@ -1283,6 +1328,11 @@ void CV_RegisterVar(consvar_t *variable)
// the SetValue will set this bit
variable->flags &= ~CV_MODIFIED;
cvar_map_t_insert(&cvar_map, variable->name, variable);
if (variable->flags & CV_NETVAR)
netvar_map_t_insert(&netvar_map, variable->netid, variable);
}
/** Finds the string value of a console variable.
@@ -1588,9 +1638,21 @@ size_t CV_LoadNetVars(const UINT8 *bufstart)
// prevent "invalid command received"
serverloading = true;
// we can use our netvar map instead of going through all cvars each time
netvar_map_t_itr it;
for (it = netvar_map_t_first(&netvar_map);
!netvar_map_t_is_end(it);
it = netvar_map_t_next(it))
{
cvar = it.data->val;
Setvalue(cvar, cvar->defaultvalue, true);
}
/*
for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (cvar->flags & CV_NETVAR)
Setvalue(cvar, cvar->defaultvalue, true);
*/
count = READUINT16(p);
while (count--)
+26 -64
View File
@@ -638,68 +638,28 @@ INT32 CON_ShiftChar(INT32 ch)
if (I_UseNativeKeyboard())
return ch;
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
{
if (cv_keyboardlayout.value == 3)
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
else
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
}
}
else // if we're holding shift we should still shift non letter symbols
{
if (cv_keyboardlayout.value == 3)
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
else
{
if (shiftdown)
ch = shiftxform[ch];
}
}
return ch;
}
INT32 CON_ShitAndAltGrChar(INT32 ch)
{
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
{
if (shiftdown ^ capslock)
ch = shiftxform[ch];
}
else // if we're holding shift we should still shift non letter symbols
else // if we're holding shift we should still shift non letter symbols
{
if (shiftdown)
ch = shiftxform[ch];
else if (altdown & 0x2)
else if (cv_keyboardlayout.value == 3)
{
ch = french_altgrxform[ch];
}
else
{
ch = HU_FallBackFrSpecialLetter(ch);
if (altdown & 0x2)
ch = french_altgrxform[ch];
else
ch = HU_FallBackFrSpecialLetter(ch);
}
}
return ch;
}
// Clear time of console heads up messages
//
void CON_ClearHUD(void)
@@ -892,7 +852,7 @@ boolean CON_Responder(event_t *ev)
return true;
// ctrl modifier -- changes behavior, adds shortcuts
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown)))
{
// show all cvars/commands that match what we have inputted
if (key == KEY_TAB)
@@ -1222,19 +1182,10 @@ void CON_LogMessage(const char *msg)
// Console print! Wahooo! Lots o fun!
//
void CONS_Printf(const char *fmt, ...)
static inline void CONS_PrintMsg(char *txt)
{
va_list argptr;
static char *txt = NULL;
boolean startup;
if (txt == NULL)
txt = malloc(8192);
va_start(argptr, fmt);
vsnprintf(txt, 8192, fmt, argptr);
va_end(argptr);
// echo console prints to log file
DEBFILE(txt);
@@ -1260,6 +1211,21 @@ void CONS_Printf(const char *fmt, ...)
}
}
void CONS_Printf(const char *fmt, ...)
{
va_list argptr;
static char *txt = NULL;
if (txt == NULL)
txt = malloc(8192);
va_start(argptr, fmt);
vsnprintf(txt, 8192, fmt, argptr);
va_end(argptr);
CONS_PrintMsg(txt);
}
void CONS_Alert(alerttype_t level, const char *fmt, ...)
{
va_list argptr;
@@ -1288,9 +1254,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
break;
}
// I am lazy and I feel like just letting CONS_Printf take care of things.
// Is that okay?
CONS_Printf("%s", txt);
CONS_PrintMsg(txt);
}
void CONS_Debug(INT32 debugflags, const char *fmt, ...)
@@ -1308,11 +1272,9 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
vsnprintf(txt, 8192, fmt, argptr);
va_end(argptr);
// Again I am lazy, oh well
CONS_Printf("%s", txt);
CONS_PrintMsg(txt);
}
// Print an error message, and wait for ENTER key to continue.
// To make sure the user has seen the message
//
-1
View File
@@ -49,7 +49,6 @@ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *or
extern UINT8 *consolebgmap;
INT32 CON_ShiftChar(INT32 ch);
INT32 CON_ShitAndAltGrChar(INT32 ch);
void CON_SetupBackColormap(void);
void CON_ClearHUD(void); // clear heads up messages
+42 -17
View File
@@ -100,6 +100,10 @@ static int map_icon_request_count; // current count of icon requests sent
static UINT8 *map_icon_data;
static patch_t *map_icon;
// if true, signals the game to only load addons AND gamestate
// instead of fully joining a server
static boolean cl_addonsonly = false;
plrinfo playerinfo[MAXPLAYERS] = {};
SINT8 joinnode = 0; // used for CL_VIEWSERVER
@@ -1411,6 +1415,7 @@ static void CL_DrawConnectionStatus(void)
// Buttons
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sSPACE%s] = Load Addons", "\x82", "\x80"));
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
}
else if (filedownload.current != -1)
@@ -2553,7 +2558,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
return true;
}
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
}
else
{
@@ -2574,6 +2579,17 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
return true;
}
static void FreeMapIcon(void)
{
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
map_icon_request_count = 0;
}
/** Called by CL_ConnectToServer
*
* \param tmpsave The name of the gamestate file???
@@ -2598,7 +2614,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ASKFULLFILELIST:
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
{
if (CL_AskFileList(fileneedednum))
@@ -2731,7 +2747,19 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
// Gamestate is now handled within CL_LoadReceivedSavegame()
CL_LoadReceivedSavegame(false);
cl_mode = CL_CONNECTED;
if (cl_addonsonly)
{
// close connection after savegame load
// we want the actual server state
// in case theres some stuff like records to be synched
cl_mode = CL_ABORTED;
}
else
{
cl_mode = CL_CONNECTED;
}
break;
} // don't break case continue to CL_CONNECTED
else
@@ -2745,7 +2773,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ABORTED:
cl_mode = CL_SEARCHING;
return false;
}
GetPackets();
@@ -2772,24 +2799,21 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
if (key == KEY_ENTER || key == KEY_JOY1)
{
cl_addonsonly = false;
cl_mode = CL_CHECKFILES;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
FreeMapIcon();
}
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
{
cl_mode = CL_ABORTED;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
map_icon_request_count = 0;
cl_addonsonly = false;
FreeMapIcon();
}
else if (key == KEY_SPACE || key == KEY_JOY1+2)
{
cl_addonsonly = true;
cl_mode = CL_CHECKFILES;
FreeMapIcon();
}
}
@@ -2798,6 +2822,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
CL_AbortConnection();
cl_addonsonly = false;
return false;
}
+1 -1
View File
@@ -1208,7 +1208,7 @@ void D_AddPostloadFiles(void)
static boolean AddIWAD(const char * file, const char *dir)
{
char * path = va(pandf, dir, file);
char *path = va(pandf, dir, file);
if (FIL_ReadFileOK(path))
{
-1
View File
@@ -1384,7 +1384,6 @@ static void I_Fork(void)
INT32 I_StartupSystem(void)
{
W_Startup();
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to
+24 -74
View File
@@ -272,7 +272,6 @@ static void clear_levels(void)
// (no need to set num to 0, we're freeing the entire header shortly)
Z_Free(mapheaderinfo[i]->customopts);
P_DeleteGrades(i);
Z_Free(mapheaderinfo[i]);
mapheaderinfo[i] = NULL;
}
@@ -836,22 +835,8 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
// Now go to uppercase
strupr(word2);
// NiGHTS grades
if (fastncmp(word, "GRADES", 6))
{
UINT8 mare = (UINT8)atoi(word + 6);
if (mare <= 0 || mare > 8)
{
deh_warning("Level header %d: unknown word '%s'", num, word);
continue;
}
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
}
// Strings that can be truncated
else if (fastcmp(word, "SCRIPTNAME"))
if (fastcmp(word, "SCRIPTNAME"))
{
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num));
@@ -863,10 +848,6 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
}
else if (fastcmp(word, "ACT"))
{
/*if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
mapheaderinfo[num-1]->actnum = (UINT8)i;
else
deh_warning("Level header %d: invalid act number %d", num, i);*/
deh_strlcpy(mapheaderinfo[num-1]->actnum, word2,
sizeof(mapheaderinfo[num-1]->actnum), va("Level header %d: actnum", num));
}
@@ -931,11 +912,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "MUSICPOS"))
mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2);
else if (fastcmp(word, "MUSICINTERFADEOUT"))
mapheaderinfo[num-1]->musinterfadeout = (UINT32)get_number(word2);
else if (fastcmp(word, "MUSICINTER"))
deh_strlcpy(mapheaderinfo[num-1]->musintername, word2,
sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num));
else if (fastcmp(word, "FORCECHARACTER"))
{
strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1);
@@ -977,44 +954,12 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
else if (fastcmp(word, "SKYBOXSCALEZ"))
mapheaderinfo[num-1]->skybox_scalez = (INT16)i;
else if (fastcmp(word, "BONUSTYPE"))
{
if (fastcmp(word2, "NONE")) i = -1;
else if (fastcmp(word2, "NORMAL")) i = 0;
else if (fastcmp(word2, "BOSS")) i = 1;
else if (fastcmp(word2, "ERZ3")) i = 2;
if (i >= -1 && i <= 2) // -1 for no bonus. Max is 2.
mapheaderinfo[num-1]->bonustype = (SINT8)i;
else
deh_warning("Level header %d: invalid bonus type number %d", num, i);
}
else if (fastcmp(word, "SAVEOVERRIDE"))
{
if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT;
else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS;
else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER;
if (i >= SAVE_NEVER && i <= SAVE_ALWAYS)
mapheaderinfo[num-1]->saveoverride = (SINT8)i;
else
deh_warning("Level header %d: invalid save override number %d", num, i);
}
else if (fastcmp(word, "LEVELFLAGS"))
mapheaderinfo[num-1]->levelflags = get_number(word2);
else if (fastcmp(word, "MENUFLAGS"))
mapheaderinfo[num-1]->menuflags = get_number(word2);
// SRB2Kart
/*else if (fastcmp(word, "AUTOMAP"))
{
if (i || word2[0] == 'T' || word2[0] == 'Y')
mapheaderinfo[num-1]->automap = true;
else
mapheaderinfo[num-1]->automap = false;
}*/
else if (fastcmp(word, "MOBJSCALE"))
mapheaderinfo[num-1]->mobj_scale = get_number(word2);
else if (fastcmp(word, "LIGHTCONTRAST") || fastcmp(word, "ENCORELIGHTCONTRAST"))
@@ -1127,6 +1072,26 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
else
mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED;
}
else if (fastcmp(word, "MUSICINTERFADEOUT"))
{
continue; // unused
}
else if (fastcmp(word, "MUSICINTER"))
{
continue; // unused
}
else if (fastcmp(word, "BONUSTYPE"))
{
continue; // unused
}
else if (fastcmp(word, "SAVEOVERRIDE"))
{
continue; // unused
}
else if (fastncmp(word, "GRADES", 6)) // NiGHTS grades
{
continue; // unused
}
else
deh_warning("Level header %d: unknown word '%s'", num, word);
}
@@ -1217,7 +1182,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
i = atoi(word2);
usi = (UINT16)i;
if (fastcmp(word, "NUMBEROFPICS"))
{
cutscenes[num]->scene[scenenum].numpics = (UINT8)i;
@@ -1898,16 +1862,8 @@ static void reademblemdata(MYFILE *f, INT32 num)
emblemlocations[num-1].type = ET_GLOBAL;
else if (fastcmp(word2, "SKIN"))
emblemlocations[num-1].type = ET_SKIN;
/*else if (fastcmp(word2, "SCORE"))
emblemlocations[num-1].type = ET_SCORE;*/
else if (fastcmp(word2, "TIME"))
emblemlocations[num-1].type = ET_TIME;
/*else if (fastcmp(word2, "RINGS"))
emblemlocations[num-1].type = ET_RINGS;
else if (fastcmp(word2, "NGRADE"))
emblemlocations[num-1].type = ET_NGRADE;
else if (fastcmp(word2, "NTIME"))
emblemlocations[num-1].type = ET_NTIME;*/
else
emblemlocations[num-1].type = (UINT8)value;
}
@@ -2196,14 +2152,11 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
}
else if ((offset=0) || fastcmp(params[0], "GAMECLEAR")
|| (++offset && fastcmp(params[0], "ALLEMERALDS")))
//|| (++offset && fastcmp(params[0], "ULTIMATECLEAR")))
{
ty = UC_GAMECLEAR + offset;
re = (params[1]) ? atoi(params[1]) : 1;
}
else if ((offset=0) || fastcmp(params[0], "OVERALLTIME"))
//|| (++offset && fastcmp(params[0], "OVERALLSCORE"))
//|| (++offset && fastcmp(params[0], "OVERALLRINGS")))
{
PARAMCHECK(1);
ty = UC_OVERALLTIME + offset;
@@ -2212,8 +2165,6 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
else if ((offset=0) || fastcmp(params[0], "MAPVISITED")
|| (++offset && fastcmp(params[0], "MAPBEATEN"))
|| (++offset && fastcmp(params[0], "MAPALLEMERALDS")))
//|| (++offset && fastcmp(params[0], "MAPULTIMATE"))
//|| (++offset && fastcmp(params[0], "MAPPERFECT")))
{
PARAMCHECK(1);
ty = UC_MAPVISITED + offset;
@@ -2231,8 +2182,6 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
}
}
else if ((offset=0) || fastcmp(params[0], "MAPTIME"))
//|| (++offset && fastcmp(params[0], "MAPSCORE"))
//|| (++offset && fastcmp(params[0], "MAPRINGS")))
{
PARAMCHECK(2);
ty = UC_MAPTIME + offset;
@@ -2615,7 +2564,7 @@ static void readmaincfg(MYFILE *f)
}
else if (fastcmp(word, "MAXXTRALIFE"))
{
maxXtraLife = (UINT8)get_number(word2);
continue; // unused
}
else if (fastcmp(word, "GAMEDATA"))
{
@@ -2645,6 +2594,7 @@ static void readmaincfg(MYFILE *f)
strcatbf(savegamename, srb2home, PATHSEP);
refreshdirmenu |= REFRESHDIR_GAMEDATA;*/
continue;
}
else if (fastcmp(word, "RESETDATA"))
{
+7
View File
@@ -573,6 +573,13 @@ INT32 I_GetKey(void);
// NOTE: you WILL have nasal troubles if the variable is not initialized
#define CLEANUP(f) __attribute__((__cleanup__(f)))
// the GNU constructor and destructor attributes
// The constructor attribute causes the function to be called automatically before execution enters main ().
// Similarly, the destructor attribute causes the function to be called automatically after main () has completed or exit () has been called.
// Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program.
#define CONSTRUCTOR __attribute__((constructor, used))
#define DESTRUCTOR __attribute__((destructor, used))
// An assert-type mechanism.
#ifdef PARANOIA
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
+3 -39
View File
@@ -205,12 +205,6 @@ extern struct quake
fixed_t radius, intensity;
} quake;
// NiGHTS grades
typedef struct
{
UINT32 grade[6]; // D, C, B, A, S, X (F: failed to reach any of these)
} nightsgrades_t;
// Custom Lua values
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
typedef struct
@@ -261,28 +255,16 @@ typedef struct
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default)
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
// NiGHTS stuff.
UINT8 numGradedMares; ///< Internal. For grade support.
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
// SRB2kart
//boolean automap; ///< Displays a level's white map outline in modified games
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
mapheader_lighting_t lighting; ///< Wall and sprite lighting
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
boolean use_encore_lighting; ///< Whether to use separate Encore lighting
// Music stuff.
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music.
// Lua stuff.
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
@@ -379,8 +361,6 @@ typedef struct
{
tic_t time; ///< Time in which the level was finished.
tic_t lap; ///< Best lap time for this level.
//UINT32 score; ///< Score when the level was finished.
//UINT16 rings; ///< Rings when the level was finished.
} recorddata_t;
/** Setup for one NiGHTS map.
@@ -394,34 +374,19 @@ typedef struct
#define GRADE_A 5
#define GRADE_S 6
/*typedef struct
{
// 8 mares, 1 overall (0)
UINT8 nummares;
UINT32 score[9];
UINT8 grade[9];
tic_t time[9];
} nightsdata_t;*/
//extern nightsdata_t *nightsrecords[NUMMAPS];
extern recorddata_t *mainrecords[NUMMAPS];
// mapvisited is now a set of flags that says what we've done in the map.
#define MV_VISITED 1
#define MV_BEATEN 2
#define MV_ALLEMERALDS 4
//#define MV_ULTIMATE 8
//#define MV_PERFECT 16
#define MV_MAX 7 // used in gamedata check
extern UINT8 mapvisited[NUMMAPS];
// Temporary holding place for nights data for the current map
//nightsdata_t ntemprecords;
extern UINT32 token; ///< Number of tokens collected in a level
extern UINT32 token; ///< Number of tokens collected in a level
extern UINT32 tokenlist; ///< List of tokens collected
extern INT32 tokenbits; ///< Used for setting token bits
extern INT32 sstimer; ///< Time allotted in the special stage
extern INT32 tokenbits; ///< Used for setting token bits
extern INT32 sstimer; ///< Time allotted in the special stage
extern UINT32 bluescore; ///< Blue Team Scores
extern UINT32 redscore; ///< Red Team Scores
@@ -461,7 +426,6 @@ extern UINT8 introtoplay;
extern UINT8 creditscutscene;
extern UINT8 use1upSound;
extern UINT8 maxXtraLife; // Max extra lives from rings
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
+5 -2
View File
@@ -2616,7 +2616,7 @@ void G_DoPlayDemo(char *defdemoname)
if (defdemoname == NULL)
{
demobuf.p = demobuf.buffer;
pdemoname = ZZ_Alloc(1); // Easier than adding checks for this everywhere it's freed
pdemoname = ZZ_Calloc(1); // Easier than adding checks for this everywhere it's freed
}
else
{
@@ -2628,7 +2628,7 @@ void G_DoPlayDemo(char *defdemoname)
n++;
pdemoname = ZZ_Alloc(strlen(n)+1);
strcpy(pdemoname,n);
strcpy(pdemoname, n);
M_SetPlaybackMenuPointer();
@@ -3090,6 +3090,9 @@ post_compat:
if (cv_director.value)
CV_SetValue(&cv_director, 0);
if (demo.timing)
G_DoneLevelLoad();
demo.deferstart = true;
}
#undef SKIPERRORS
-2
View File
@@ -97,7 +97,6 @@ boolean savemoddata = false;
UINT8 paused = 0;
UINT8 modeattacking = ATTACKING_NONE;
boolean imcontinuing = false;
boolean runemeraldmanager = false;
boolean netgame = false; // only true if packets are broadcast
boolean multiplayer = false;
@@ -210,7 +209,6 @@ const INT32 wantedfrequency = 10*TICRATE;
INT32 gameovertics = 15*TICRATE;
UINT8 use1upSound = 0;
UINT8 maxXtraLife = 2; // Max extra lives from rings
UINT8 introtoplay = 0;
UINT8 creditscutscene = 0;
+7 -8
View File
@@ -3681,7 +3681,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
hwrpatch = static_cast<GLPatch_t *>(gpatch->hardware);
// Draw shadow BEFORE sprite
if (UNLIKELY(cv_shadow.value // Shadows enabled
@@ -3783,10 +3783,10 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
{
// make hyu´d players translucent with reducevfx, could be done better, but im lazy as crap
if (cv_reducevfx.value && sprmo->player->kartstuff[k_hyudorotimer] > 0)
Surf.PolyColor.s.alpha = FixedMul(FRACUNIT/2, Surf.PolyColor.s.alpha);
Surf.PolyColor.s.alpha = static_cast<UINT8>(FixedMul(FRACUNIT/2, static_cast<fixed_t>(Surf.PolyColor.s.alpha)));
if (cv_playerfade.value)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
Surf.PolyColor.s.alpha = static_cast<UINT8>(FixedMul(R_DoPlayerFade(sprmo), static_cast<fixed_t>(Surf.PolyColor.s.alpha)));
}
if (HWR_UseShader())
@@ -3969,7 +3969,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
hwrpatch = static_cast<GLPatch_t *>(gpatch->hardware);
// create the sprite billboard
//
@@ -4080,10 +4080,10 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
{
// make hyu´d players translucent with reducevfx, could be done better, but im lazy as crap
if (cv_reducevfx.value && sprmo->player->kartstuff[k_hyudorotimer] > 0)
Surf.PolyColor.s.alpha = FixedMul(FRACUNIT/2, Surf.PolyColor.s.alpha);
Surf.PolyColor.s.alpha = static_cast<UINT8>(FixedMul(FRACUNIT/2, static_cast<fixed_t>(Surf.PolyColor.s.alpha)));
if (cv_playerfade.value)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(sprmo), Surf.PolyColor.s.alpha);
Surf.PolyColor.s.alpha = static_cast<UINT8>(FixedMul(R_DoPlayerFade(sprmo), static_cast<fixed_t>(Surf.PolyColor.s.alpha)));
}
if (HWR_UseShader())
@@ -4119,7 +4119,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
hwrpatch = static_cast<GLPatch_t *>(gpatch->hardware);
// create the sprite billboard
//
@@ -4510,7 +4510,6 @@ static void HWR_RenderDrawNodes(void)
drawnodes.clear(); // clear so our size is 0 again!
}
// --------------------------------------------------------------------------
// Draw all vissprites
// --------------------------------------------------------------------------
+67 -61
View File
@@ -97,7 +97,6 @@ static textinput_t w_chat;
static boolean headsupactive = false;
boolean hu_showscores = false; // draw rankings
static char hu_tick;
static tic_t hu_emoteanim = 0;
emote_autocomplete_t emote_autocomplete = {0};
static huddrawlist_h luahuddrawlist_scores = NULL;
@@ -907,7 +906,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
target = READSINT8(*p);
flags = READUINT8(*p);
msg = buf;
READSTRINGL(*p, msg, HU_MAXMSGLEN + 1);
READSTRINGN(*p, msg, HU_MAXMSGLEN + 1);
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
{
@@ -1095,7 +1094,6 @@ void HU_Ticker(void)
return;
hu_tick++;
hu_emoteanim++;
hu_tick &= 7; // currently only to blink chat input cursor
if (PLAYER1INPUTDOWN(gc_scores))
@@ -1810,6 +1808,7 @@ static void HU_DrawChat(void)
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday!
INT32 cflag = 0;
INT32 pm_offset = 0; // for cases when you type emote while also doing /pm
size_t select_start = 0, select_end = 0;
const char *ntalk = "Say: ", *ttalk = "Team: ";
const char *talk = ntalk;
@@ -1921,64 +1920,6 @@ static void HU_DrawChat(void)
}
}
if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1))
{
emote_t *suggest;
int skip = 0;
const char *complete;
int complete_len;
if (emote_autocomplete.complete[0])
{
complete = emote_autocomplete.complete;
complete_len = strlen(complete);
}
else
{
complete = &w_chat_buf[emote_autocomplete.emotestart];
complete_len = w_chat.cursor - emote_autocomplete.emotestart;
}
// A bit of copy-paste from /pm code :p
INT32 suggesty = chaty - charheight - 1;
size_t longest_suggestion_length = 0;
while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL)
{
longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name));
++skip;
}
skip = 0;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
suggesty -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
suggesty += 16;
}
else
#endif
suggesty -= (cv_kartspeedometer.value ? 16 : 0);
while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL)
{
V_DrawFillConsoleMap(chatx + boxw + 2, suggesty - (7*skip), (longest_suggestion_length+2)*4 + EMOTEWIDTH, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
// Highlight currently suggested emote
int hlflag = 0;
if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0])
hlflag = V_YELLOWMAP;
V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name));
M_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
++skip;
}
}
// handle /pm list. It's messy, horrible and I don't care.
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
{
@@ -2059,9 +2000,74 @@ static void HU_DrawChat(void)
if (count == 0) // no results.
{
pm_offset = 48 + 2;
V_DrawFillConsoleMap(chatx + boxw + 2, p_dispy - (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud.
V_DrawSmallString(chatx + boxw + 4, p_dispy - (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT.");
}
else
{
pm_offset = (longest_name_length+4)*4 + 2;
}
}
if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1))
{
emote_t *suggest;
int skip = 0;
const char *complete;
int complete_len;
if (emote_autocomplete.complete[0])
{
complete = emote_autocomplete.complete;
complete_len = strlen(complete);
}
else
{
complete = &w_chat_buf[emote_autocomplete.emotestart];
complete_len = w_chat.cursor - emote_autocomplete.emotestart;
}
// A bit of copy-paste from /pm code :p
INT32 suggesty = chaty - charheight - 1;
size_t longest_suggestion_length = 0;
while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL)
{
longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name));
++skip;
}
INT32 emote_suggest_boxw = (longest_suggestion_length+2)*4 + EMOTEWIDTH;
skip = 0;
#ifdef NETSPLITSCREEN
if (splitscreen)
{
suggesty -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
suggesty += 16;
}
else
#endif
suggesty -= (cv_kartspeedometer.value ? 16 : 0);
while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL)
{
V_DrawFillConsoleMap(chatx + boxw + pm_offset + 2, suggesty - (7*skip), emote_suggest_boxw, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
// Highlight currently suggested emote
int hlflag = 0;
if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0])
hlflag = V_YELLOWMAP;
V_DrawSmallString(chatx + boxw + pm_offset + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name));
M_DrawEmote(chatx + boxw + pm_offset + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
++skip;
}
}
HU_drawChatLog(typelines - 1); // typelines is the # of lines we're typing. If there's more than 1 then the log should scroll up to give us more space.
+7 -17
View File
@@ -199,7 +199,7 @@ FUNCINLINE static ATTRINLINE void add_hook(hook_t *map)
FUNCINLINE static ATTRINLINE void add_mobj_hook(lua_State *L, int hook_type)
{
mobjtype_t mobj_type = luaL_optnumber(L, 3, MT_NULL);
mobjtype_t mobj_type = luaL_optnumber(L, 3, MT_NULL);
luaL_argcheck(L, mobj_type < NUMMOBJTYPES, 3, "invalid mobjtype_t");
@@ -296,8 +296,7 @@ struct Hook_State {
INT32 status;/* return status to calling function */
void * userdata;
int hook_type;
mobjtype_t mobj_type;/* >0 if mobj hook */
boolean force_mobj;// allows mobj_type equal 0
mobjtype_t mobj_type;/* <NUMMOBJTYPES if mobj hook */
const char * string;/* used to fetch table, ran first if set */
int top;/* index of last argument passed to hook */
int id;/* id to fetch ref */
@@ -364,10 +363,8 @@ FUNCINLINE static ATTRINLINE boolean prepare_hook
int default_status,
int hook_type
){
hook->force_mobj = false;
return init_hook_type(hook, default_status,
hook_type, 0, NULL,
hook_type, NUMMOBJTYPES, NULL,
hookIds[hook_type].numHooks);
}
@@ -381,8 +378,6 @@ FUNCINLINE static ATTRINLINE boolean prepare_mobj_hook
const mobjtype_t mobj_type =
primary_mobj ? primary_mobj->type : NUMMOBJTYPES;
hook->force_mobj = true;
return init_hook_type(hook, default_status,
hook_type, mobj_type, NULL,
mobj_hook_available(hook_type, mobj_type));
@@ -395,10 +390,8 @@ FUNCINLINE static ATTRINLINE boolean prepare_string_hook
int hook_type,
const char * string
){
hook->force_mobj = false;
if (init_hook_type(hook, default_status,
hook_type, 0, string,
hook_type, NUMMOBJTYPES, string,
stringHooks[hook_type].ref))
{
lua_pushstring(gL, string);
@@ -414,7 +407,7 @@ FUNCINLINE static ATTRINLINE boolean prepare_hud_hook
int hook_type
){
return init_hook_type(hook, 0,
hook_type, 0, NULL,
hook_type, NUMMOBJTYPES, NULL,
hudHookIds[hook_type].numHooks);
}
@@ -554,14 +547,11 @@ static int call_hooks
{
calls += call_string_hooks(hook);
}
else if (hook->force_mobj)
else if (hook->mobj_type < NUMMOBJTYPES)
{
/* call generic mobj hooks first */
calls += call_mobj_type_hooks(hook, MT_NULL);
if (hook->mobj_type < NUMMOBJTYPES)
calls += call_mobj_type_hooks(hook, hook->mobj_type);
calls += call_mobj_type_hooks(hook, hook->mobj_type);
ps_lua_mobjhooks.value.i += calls;
}
else
+5 -10
View File
@@ -1506,7 +1506,6 @@ enum mapheaderinfo_e
mapheaderinfo_saveoverride,
mapheaderinfo_levelflags,
mapheaderinfo_menuflags,
//mapheaderinfo_automap,
mapheaderinfo_mobj_scale,
};
@@ -1542,7 +1541,6 @@ static const char *const mapheaderinfo_opt[] = {
"saveoverride",
"levelflags",
"menuflags",
//"automap",
"mobj_scale",
NULL,
};
@@ -1584,10 +1582,11 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->muspos);
break;
case mapheaderinfo_musinterfadeout:
lua_pushinteger(L, header->musinterfadeout);
lua_pushinteger(L, 0); // unused
break;
case mapheaderinfo_musintername:
lua_pushstring(L, header->musintername);
// uhh psure its fine to just push nil instead of empty string?
lua_pushstring(L, NULL);
break;
case mapheaderinfo_forcecharacter:
lua_pushstring(L, header->forcecharacter);
@@ -1641,10 +1640,10 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->levelselect);
break;
case mapheaderinfo_bonustype:
lua_pushinteger(L, header->bonustype);
lua_pushinteger(L, 0); // unused
break;
case mapheaderinfo_saveoverride:
lua_pushinteger(L, header->saveoverride);
lua_pushinteger(L, SAVE_DEFAULT); // unused
break;
case mapheaderinfo_levelflags:
lua_pushinteger(L, header->levelflags);
@@ -1652,13 +1651,9 @@ static int mapheaderinfo_get(lua_State *L)
case mapheaderinfo_menuflags:
lua_pushinteger(L, header->menuflags);
break;
/*case mapheaderinfo_automap:
lua_pushstring(L, header->selectheading);
break;*/
case mapheaderinfo_mobj_scale:
lua_pushfixed(L, header->mobj_scale);
break;
// TODO add support for reading numGradedMares and grades
default:
{
// Read custom vars now
+3 -22
View File
@@ -479,32 +479,13 @@ UINT8 M_CheckLevelEmblems(void)
// Update Score, Time, Rings emblems
for (i = 0; i < numemblems; ++i)
{
if (emblemlocations[i].type <= ET_SKIN || emblemlocations[i].collected)
// Requires time on map <= x
if (emblemlocations[i].type != ET_TIME || emblemlocations[i].collected)
continue;
levelnum = emblemlocations[i].level;
valToReach = emblemlocations[i].var;
switch (emblemlocations[i].type)
{
/*case ET_SCORE: // Requires score on map >= x
res = (G_GetBestScore(levelnum) >= (unsigned)valToReach);
break;*/
case ET_TIME: // Requires time on map <= x
res = (G_GetBestTime(levelnum) <= (unsigned)valToReach);
break;
/*case ET_RINGS: // Requires rings on map >= x
res = (G_GetBestRings(levelnum) >= valToReach);
break;
case ET_NGRADE: // Requires NiGHTS grade on map >= x
res = (G_GetBestNightsGrade(levelnum, 0) >= valToReach);
break;
case ET_NTIME: // Requires NiGHTS time on map <= x
res = (G_GetBestNightsTime(levelnum, 0) <= (unsigned)valToReach);
break;*/
default: // unreachable but shuts the compiler up.
continue;
}
res = (G_GetBestTime(levelnum) <= (unsigned)valToReach);
emblemlocations[i].collected = res;
if (res)
-10
View File
@@ -27,21 +27,11 @@ typedef enum
UC_MATCHESPLAYED, // SRB2Kart: MATCHESPLAYED [x played]
UC_GAMECLEAR, // GAMECLEAR <x times>
UC_ALLEMERALDS, // ALLEMERALDS <x times>
//UC_ULTIMATECLEAR, // ULTIMATECLEAR <x times>
//UC_OVERALLSCORE, // OVERALLSCORE [score to beat]
UC_OVERALLTIME, // OVERALLTIME [time to beat, tics]
//UC_OVERALLRINGS, // OVERALLRINGS [rings to beat]
UC_MAPVISITED, // MAPVISITED [map number]
UC_MAPBEATEN, // MAPBEATEN [map number]
UC_MAPALLEMERALDS, // MAPALLEMERALDS [map number]
//UC_MAPULTIMATE, // MAPULTIMATE [map number]
//UC_MAPPERFECT, // MAPPERFECT [map number]
//UC_MAPSCORE, // MAPSCORE [map number] [score to beat]
UC_MAPTIME, // MAPTIME [map number] [time to beat, tics]
//UC_MAPRINGS, // MAPRINGS [map number] [rings to beat]
//UC_NIGHTSSCORE, // NIGHTSSCORE [map number] <mare, omit or "0" for overall> [score to beat]
//UC_NIGHTSTIME, // NIGHTSTIME [map number] <mare, omit "0" overall> [time to beat, tics]
//UC_NIGHTSGRADE, // NIGHTSGRADE [map number] <mare, omit "0" overall> [grade]
UC_TRIGGER, // TRIGGER [trigger number]
UC_TOTALEMBLEMS, // TOTALEMBLEMS [number of emblems]
UC_EMBLEM, // EMBLEM [emblem number]
+1 -1
View File
@@ -278,7 +278,7 @@ void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, INT3
static void Command_ListEmotes_f(void)
{
const int EMOTES_PER_PAGE = 24;
const int NUMPAGES = std::max<int>(emotes.size()/EMOTES_PER_PAGE, 1);
const int NUMPAGES = emotes.size()/EMOTES_PER_PAGE + (emotes.size() % EMOTES_PER_PAGE != 0 ? 1 : 0);
int page = 1;
if (COM_Argc() > 1)
+33 -18
View File
@@ -186,8 +186,8 @@ static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10; // skull animation counter
static boolean interpTimerHackAllow = 0;
static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
// shhh... what am I doing... nooooo!
static INT32 vidm_testingmode = 0;
@@ -201,8 +201,8 @@ static char setupm_ip[64];
static textinput_t setupm_input_ip;
static fixed_t multi_tics;
static state_t *multi_state;
static fixed_t multi_tics;
static state_t *multi_state;
// this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2
@@ -1024,9 +1024,9 @@ boolean M_Responder(event_t *ev)
//case KEY_JOY1 + 2:
ch = KEY_ENTER;
break;
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
ch = 'n';
break;*/
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
ch = 'n';
break;*/
case KEY_MOUSE1 + 1:
//case KEY_JOY1 + 1:
ch = KEY_BACKSPACE;
@@ -1305,12 +1305,21 @@ boolean M_Responder(event_t *ev)
{
playback_last_menu_interaction_leveltime = leveltime;
// Flip left/right with up/down for the playback menu, since it's a horizontal icon row.
switch (ch)
{
case KEY_LEFTARROW: ch = KEY_UPARROW; break;
case KEY_UPARROW: ch = KEY_RIGHTARROW; break;
case KEY_RIGHTARROW: ch = KEY_DOWNARROW; break;
case KEY_DOWNARROW: ch = KEY_LEFTARROW; break;
case KEY_LEFTARROW:
ch = KEY_UPARROW;
break;
case KEY_UPARROW:
ch = KEY_RIGHTARROW;
break;
case KEY_RIGHTARROW:
ch = KEY_DOWNARROW;
break;
case KEY_DOWNARROW:
ch = KEY_LEFTARROW;
break;
// arbitrary keyboard shortcuts because fuck you
@@ -1361,7 +1370,8 @@ boolean M_Responder(event_t *ev)
G_AdjustView(4, 1, true);
break;
default: break;
default:
break;
}
}
@@ -1486,6 +1496,7 @@ boolean M_Responder(event_t *ev)
}
return false;
break;
default:
CON_Responder(ev);
@@ -2064,7 +2075,6 @@ void M_Init(void)
OP_OpenGLOptionsMenu[op_gl_shader].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_lightdither].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_palrender].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = IT_GRAYEDOUT;
OP_ExpOptionsMenu[op_exp_paldepth].status = IT_GRAYEDOUT;
}
@@ -4113,6 +4123,9 @@ static void AddCheckedReplay(void)
// Check up to maxnum replays if they match with query
static void M_HutCheckReplays(size_t maxnum)
{
// Stripped of color codes
char demo_title[sizeof(demolist_all[0].title)];
if (!replaynamesloaded)
return;
@@ -4145,7 +4158,9 @@ static void M_HutCheckReplays(size_t maxnum)
case MD_NOTLOADED:
case MD_OUTDATED:
case MD_LOADED:
if (demolist_all[replayquerycheck].title[0] && strcasestr(demolist_all[replayquerycheck].title, replayqueryinput.buffer) != NULL)
StripColors(demo_title, demolist_all[replayquerycheck].title, sizeof(demo_title));
if (demolist_all[replayquerycheck].title[0] && strcasestr(demo_title, replayqueryinput.buffer) != NULL)
AddCheckedReplay(); // It matches, add it!
else
replayquerycheck++; // Doesn't match, moving on...
@@ -4905,6 +4920,7 @@ static void M_HutStartReplay(INT32 choice)
demo.loadfiles = (itemOn == 0);
demo.ignorefiles = (itemOn != 0);
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), demolist[dir_on[menudepthleft]].filepath);
G_DoPlayDemo(demolist[dir_on[menudepthleft]].filepath);
}
@@ -6466,7 +6482,7 @@ static void M_ChooseTimeAttack(INT32 choice)
static void M_HandleStaffReplay(INT32 choice)
{
boolean exitmenu = false; // exit to previous menu
lumpnum_t l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),cv_dummystaff.value));
lumpnum_t l = W_CheckNumForName(va("%sS%02u", G_BuildMapName(cv_nextmap.value), cv_dummystaff.value));
switch (choice)
{
@@ -6496,7 +6512,7 @@ static void M_HandleStaffReplay(INT32 choice)
M_ClearMenus(true);
modeattacking = ATTACKING_RECORD;
demo.loadfiles = false; demo.ignorefiles = true; // Just assume that record attack replays have the files needed
G_DoPlayDemo(va("%sS%02u",G_BuildMapName(cv_nextmap.value),cv_dummystaff.value));
G_DoPlayDemo(va("%sS%02u", G_BuildMapName(cv_nextmap.value), cv_dummystaff.value));
break;
default:
break;
@@ -7940,7 +7956,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH);
patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH);
patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH);
patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0", PU_PATCH);
patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0" , PU_PATCH);
patch_t *patch;
UINT8 frame;
UINT8 speed;
@@ -10041,7 +10057,6 @@ static void M_DrawVideoMode(void)
va("Wait %d second%s", testtime, (testtime > 1) ? "s" : ""));
M_CentreText(OP_VideoModeDef.y + 158,
"or press ESC to return");
}
else
{
-3
View File
@@ -1043,7 +1043,6 @@ static const char* OP_OpenGLTooltips[] =
"Fallback 3D model for characters that don't have any.",
"Graphical Shaders.",
"Recreates the look of software mode.",
"Flash palettes for palette rendering.",
"Bit-depth of textures.",
"Filter to use on textures.",
"Anisotropic filtering.",
@@ -1062,7 +1061,6 @@ enum
op_gl_falbckmdls,
op_gl_shader,
op_gl_palrender,
op_gl_flashpal,
op_gl_scrdepth,
op_gl_filter,
op_gl_anis,
@@ -2772,6 +2770,5 @@ void M_UpdateOGLMenu(void)
OP_OpenGLOptionsMenu[op_gl_lightdither].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_palrender].status = (cv_glscreentextures.value != 2 || !HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
}
#endif
+2 -2
View File
@@ -256,7 +256,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot
return true;
}
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown)))
{
if (key == 'x' || key == 'X')
{
@@ -392,7 +392,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot
key = '/';
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key);
key = CON_ShiftChar(key);
// enter a char into the command prompt
if (key < 32 || key > 127)
+9 -59
View File
@@ -122,27 +122,6 @@ static void P_CycleMobjState(mobj_t *mobj)
}
}
//
// P_CycleMobjState for players.
//
static void P_CyclePlayerMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
{
mobj->tics--;
// you can cycle through multiple states in a tic
if (!mobj->tics && mobj->state)
if (!P_SetPlayerMobjState(mobj, mobj->state->nextstate))
return; // freed itself
}
}
#define MAX_RECURSION 20
//
@@ -1670,6 +1649,14 @@ void P_XYMovement(mobj_t *mo)
if (mo->flags & MF_NOCLIPHEIGHT)
return; // no frictions for objects that can pass through floors
//{ SRB2kart stuff
if (mo->type == MT_ORBINAUT || mo->type == MT_JAWZ_DUD || mo->type == MT_JAWZ || mo->type == MT_BALLHOG) //(mo->type == MT_JAWZ && !mo->tracer))
return;
if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= K_GetKartSpeed(mo->player, false)/2)
return;
//}
if (mo->flags & MF_MISSILE || mo->flags2 & MF2_SKULLFLY || mo->type == MT_SHELL || mo->type == MT_VULTURE)
return; // no friction for missiles ever
@@ -1683,14 +1670,6 @@ void P_XYMovement(mobj_t *mo)
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
return;
//{ SRB2kart stuff
if (mo->type == MT_ORBINAUT || mo->type == MT_JAWZ_DUD || mo->type == MT_JAWZ || mo->type == MT_BALLHOG) //(mo->type == MT_JAWZ && !mo->tracer))
return;
if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= K_GetKartSpeed(mo->player, false)/2)
return;
//}
if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
&& !(player && player->pflags & PF_SLIDING))
return; // no friction when airborne
@@ -3210,30 +3189,6 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
return false;
}
void P_DestroyRobots(void)
{
// Search through all the thinkers for enemies.
mobj_t *mo;
thinker_t *think;
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
mo = (mobj_t *)think;
if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS))
continue; // not a valid enemy
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
// Found a target enemy
P_KillMobj(mo, players[consoleplayer].mo, players[consoleplayer].mo);
}
}
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
{
@@ -9221,10 +9176,7 @@ void P_MobjThinker(mobj_t *mobj)
}
// Can end up here if a player dies.
if (mobj->player)
P_CyclePlayerMobjState(mobj);
else
P_CycleMobjState(mobj);
P_CycleMobjState(mobj);
if (P_MobjWasRemoved(mobj))
return;
@@ -11118,8 +11070,6 @@ void P_SpawnMapThing(mapthing_t *mthing)
{
if (!cv_powerstones.value || !G_BattleGametype())
return;
runemeraldmanager = true;
}
if (!G_RaceGametype()) // No enemies in match or CTF modes
-2
View File
@@ -499,7 +499,6 @@ void P_SpawnPrecipitation(void);
void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, statenum_t nstate, angle_t rotangle, boolean spawncenter);
boolean P_BossTargetPlayer(mobj_t *actor, boolean closest);
boolean P_SupermanLook4Players(mobj_t *actor);
void P_DestroyRobots(void);
boolean P_PrecipThinker(precipmobj_t *mobj);
void P_NullPrecipThinker(precipmobj_t *mobj);
void P_FreePrecipMobj(precipmobj_t *mobj);
@@ -510,7 +509,6 @@ void P_EmeraldManager(void);
#define MAXHUNTEMERALDS 64
extern mapthing_t *huntemeralds[MAXHUNTEMERALDS];
extern INT32 numhuntemeralds;
extern boolean runemeraldmanager;
extern INT32 numstarposts;
#ifdef __cplusplus
-105
View File
@@ -218,8 +218,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->musname[6] = 0;
mapheaderinfo[num]->mustrack = 0;
mapheaderinfo[num]->muspos = 0;
mapheaderinfo[num]->musinterfadeout = 0;
mapheaderinfo[num]->musintername[0] = '\0';
mapheaderinfo[num]->forcecharacter[0] = '\0';
mapheaderinfo[num]->weather = 0;
mapheaderinfo[num]->skynum = 1;
@@ -237,16 +235,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT;
mapheaderinfo[num]->unlockrequired = -1;
mapheaderinfo[num]->levelselect = 0;
mapheaderinfo[num]->bonustype = 0;
mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
mapheaderinfo[num]->levelflags = 0;
mapheaderinfo[num]->menuflags = (mainwads ? 0 : LF2_EXISTSHACK); // see p_setup.c - prevents replacing maps in addons with easier versions
// TODO grades support for delfile (pfft yeah right)
P_DeleteGrades(num);
// SRB2Kart
//mapheaderinfo[num]->automap = false;
mapheaderinfo[num]->mobj_scale = FRACUNIT;
mapheaderinfo[num]->customopts = NULL;
@@ -266,107 +258,11 @@ void P_AllocMapHeader(INT16 i)
if (!mapheaderinfo[i])
{
mapheaderinfo[i] = Z_Malloc(sizeof(mapheader_t), PU_STATIC, NULL);
mapheaderinfo[i]->grades = NULL;
}
P_ClearSingleMapHeaderInfo(i + 1);
}
/** NiGHTS Grades are a special structure,
* we initialize them here.
*
* \param i Index of header to allocate grades for
* \param mare The mare we're adding grades for
* \param grades the string from DeHackEd, we work with it ourselves
*/
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext)
{
INT32 g;
char *spos = gtext;
CONS_Debug(DBG_SETUP, "Map %d Mare %d: ", i+1, (UINT16)mare+1);
if (mapheaderinfo[i]->numGradedMares < mare+1)
{
mapheaderinfo[i]->numGradedMares = mare+1;
mapheaderinfo[i]->grades = Z_Realloc(mapheaderinfo[i]->grades, sizeof(nightsgrades_t) * mapheaderinfo[i]->numGradedMares, PU_STATIC, NULL);
}
for (g = 0; g < 6; ++g)
{
// Allow "partial" grading systems
if (spos != NULL)
{
mapheaderinfo[i]->grades[mare].grade[g] = atoi(spos);
CONS_Debug(DBG_SETUP, "%u ", atoi(spos));
// Grab next comma
spos = strchr(spos, ',');
if (spos)
++spos;
}
else
{
// Grade not reachable
mapheaderinfo[i]->grades[mare].grade[g] = UINT32_MAX;
}
}
CONS_Debug(DBG_SETUP, "\n");
}
/** And this removes the grades safely.
*
* \param i The header to remove grades from
*/
void P_DeleteGrades(INT16 i)
{
Z_Free(mapheaderinfo[i]->grades);
mapheaderinfo[i]->grades = NULL;
mapheaderinfo[i]->numGradedMares = 0;
}
/** And this fetches the grades
*
* \param pscore The player's score.
* \param map The game map.
* \param mare The mare to test.
*/
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare)
{
INT32 i;
// Determining the grade
if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades && mapheaderinfo[map-1]->numGradedMares >= mare + 1)
{
INT32 pgrade = 0;
for (i = 0; i < 6; ++i)
{
if (pscore >= mapheaderinfo[map-1]->grades[mare].grade[i])
++pgrade;
}
return (UINT8)pgrade;
}
return 0;
}
UINT8 P_HasGrades(INT16 map, UINT8 mare)
{
// Determining the grade
// Mare 0 is treated as overall and is true if ANY grades exist
return (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades
&& (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare));
}
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
{
// Get the score for the grade... if it exists
if (grade == GRADE_F || grade > GRADE_S || !P_HasGrades(map, mare)) return 0;
return mapheaderinfo[map-1]->grades[mare].grade[grade-1];
}
// Loads the vertexes for a level.
FUNCINLINE static ATTRINLINE void P_LoadVertices(UINT8 *data)
{
@@ -2047,7 +1943,6 @@ static void P_LevelInitStuff(boolean reloadinggamestate)
// special stage tokens, emeralds, and ring total
tokenbits = 0;
runemeraldmanager = false;
nummaprings = nummapboxes = numgotboxes = 0;
// emerald hunt
-7
View File
@@ -114,13 +114,6 @@ size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i);
// Needed for NiGHTS
void P_DeleteGrades(INT16 i);
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
UINT8 P_HasGrades(INT16 map, UINT8 mare);
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
#ifdef __cplusplus
} // extern "C"
#endif
+2 -2
View File
@@ -76,8 +76,8 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
*/
light = FixedMul(nX, FINECOSINE(maplighting.angle >> ANGLETOFINESHIFT))
+ FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT));
light = (light + FRACUNIT) / 2;
+ FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT));
light = (light + FRACUNIT) / 2;
}
else
{
+14 -10
View File
@@ -1992,20 +1992,23 @@ static void P_3dMovement(player_t *player)
K_MomentumToFacing(player);
}
const fixed_t kartspd = K_GetKartSpeed(player, true);
// Sideways movement
if (cmd->sidemove != 0 && !((player->exiting || mapreset) || player->kartstuff[k_spinouttimer]))
{
if (cmd->sidemove > 0)
movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true));
movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, kartspd);
else
movepushside = (cmd->sidemove * FRACUNIT/128) - FixedDiv(player->speed, K_GetKartSpeed(player, true));
movepushside = (cmd->sidemove * FRACUNIT/128) - FixedDiv(player->speed, kartspd);
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside);
}
if ((totalthrust.x || totalthrust.y)
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2)
{
// Factor thrust to slope, but only for the part pushing up it!
// The rest is unaffected.
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
@@ -2041,11 +2044,11 @@ static void P_3dMovement(player_t *player)
// -Shadow Hog
newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
if (newMagnitude > K_GetKartSpeed(player, true)) //topspeed)
if (newMagnitude > kartspd) //topspeed)
{
fixed_t tempmomx, tempmomy;
if (oldMagnitude > K_GetKartSpeed(player, true) && onground) // SRB2Kart: onground check for air speed cap
if (oldMagnitude > kartspd && onground) // SRB2Kart: onground check for air speed cap
{
if (newMagnitude > oldMagnitude)
{
@@ -2058,8 +2061,8 @@ static void P_3dMovement(player_t *player)
}
else
{
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), kartspd); //topspeed)
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), kartspd); //topspeed)
player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy;
}
@@ -2474,9 +2477,10 @@ static void P_MovePlayer(player_t *player)
const fixed_t runnyspeed = 20*FRACUNIT;
speed = R_PointToDist2(player->rmomx, player->rmomy, 0, 0);
const fixed_t kartspd = K_GetKartSpeed(player, false);
if (speed > K_GetKartSpeed(player, false)-(5<<FRACBITS))
speed = K_GetKartSpeed(player, false)-(5<<FRACBITS);
if (speed > kartspd-(5<<FRACBITS))
speed = kartspd-(5<<FRACBITS);
if (speed >= runnyspeed)
player->fovadd = speed-runnyspeed;
@@ -4584,7 +4588,7 @@ void P_PlayerThink(player_t *player)
}
#ifdef SEENAMES
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen)
if (netgame && !splitscreen && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)))
{
seenplayer = NULL;
+1 -1
View File
@@ -400,7 +400,7 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f
case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break;
case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break;
case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break;
default: skintableindex = skinnum; break;
default: skintableindex = skinnum; break;
}
}
+9
View File
@@ -1222,6 +1222,15 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
if (yl < top)
yl = top;
// insanely shitty hack to fix flickering on some maps
// for god knows why, on secret slide the renderer assumes some double sided linedefs have insanely tall walls
// since such tall walls are effectively nonsense in any case
// just skip them
if (yl > FRACUNIT*3)
{
continue;
}
if (markceiling)
{
bottom = yl > floorclip[rw_x] ? floorclip[rw_x] : yl;
+10 -7
View File
@@ -1662,7 +1662,7 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->frame & FF_ABSOLUTELIGHTLEVEL)
{
const UINT8 n = R_ThingLightLevel(thing);
const UINT8 n = static_cast<UINT8>(R_ThingLightLevel(thing));
// n = uint8 aka 0 - 255, so the shift will always be 0 - LIGHTLEVELS - 1
lights_array = scalelight[n >> LIGHTSEGSHIFT];
}
@@ -2963,18 +2963,21 @@ fixed_t R_DoPlayerFade(mobj_t *thing)
if (thing->player == viewplayer || viewplayer->exiting || viewplayer->spectator || camera[R_GetViewNumber()].freecam || leveltime < countdownstarttime)
return fadealpha;
const INT32 playerdist = (FixedMul((thing->x - viewx), viewcos) + FixedMul((thing->y - viewy), viewsin)) >> FRACBITS;
const INT32 viewplayerdist = (FixedMul((viewplayer->mo->x - viewx), viewcos) + FixedMul((viewplayer->mo->y - viewy), viewsin)) >> FRACBITS;
const INT32 otherplayerdist = (FixedMul((thing->x - viewx), viewcos) + FixedMul((thing->y - viewy), viewsin)) >> FRACBITS;
const INT32 viewplayerdist = (FixedMul((viewplayer->mo->x - viewx), viewcos) + FixedMul((viewplayer->mo->y - viewy), viewsin)) >> FRACBITS;
if (playerdist < viewplayerdist)
if (viewplayerdist < 2)
return fadealpha; // avoid zero division
if (otherplayerdist < viewplayerdist)
{
if (playerdist < viewplayerdist / 2) // stronger fade when very close
if (otherplayerdist < viewplayerdist / 2) // stronger fade when very close
{
fadealpha = (playerdist * FRACUNIT) / (viewplayerdist / 2) / 3;
fadealpha = (otherplayerdist * FRACUNIT) / (viewplayerdist / 2) / 3;
}
else
{
fadealpha = (playerdist * FRACUNIT) / viewplayerdist;
fadealpha = (otherplayerdist * FRACUNIT) / viewplayerdist;
}
}
-2
View File
@@ -1887,8 +1887,6 @@ INT32 I_StartupSystem(void)
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
W_Startup();
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to
+8 -1
View File
@@ -462,6 +462,8 @@ License (MIT):
#include <stdbool.h>
#include <string.h>
#include "fastcmp.h"
// Two-way concatenation macro.
#define VT_CAT_( a, b ) a##b
#define VT_CAT( a, b ) VT_CAT_( a, b )
@@ -705,7 +707,12 @@ static inline FORCE_INLINE bool vt_cmpr_integer( uint64_t key_1, uint64_t key_2
static inline FORCE_INLINE bool vt_cmpr_string( const char *key_1, const char *key_2 )
{
return strcmp( key_1, key_2 ) == 0;
return fastcmp( key_1, key_2 );
}
static inline FORCE_INLINE bool vt_cmpr_casestring( const char *key_1, const char *key_2 )
{
return fasticmp( key_1, key_2 );
}
// Default allocation and free functions.
+2 -3
View File
@@ -158,8 +158,7 @@ void W_Shutdown(void)
}
// the lumpnum cache needs to be initialized before use
// call this as early as possible!
void W_Startup(void)
CONSTRUCTOR static void W_Startup(void)
{
lumpnum_map_init(&lumpnumcache);
lumpnum_map_reserve(&lumpnumcache, LUMPNUMCACHESIZE);
@@ -367,7 +366,7 @@ static inline INT32 W_MakeFileMD5(const char *filename, void *resblock)
{
precise_t t = I_GetPreciseTime();
CONS_Debug(DBG_SETUP, "Making MD5 for %s\n",filename);
CONS_Debug(DBG_SETUP, "Making MD5 for %s\n", filename);
if (md5_stream(fhandle, resblock) == 1)
{
-1
View File
@@ -154,7 +154,6 @@ extern wadfile_t *wadfiles[MAX_WADFILES];
// =========================================================================
void W_Startup(void);
void W_Shutdown(void);
// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened