Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Dec 7, 2023
1 parent 73db9e8 commit 66acb9f
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 50 deletions.
50 changes: 25 additions & 25 deletions src/c_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -2535,7 +2535,7 @@ static void exitmap_func2(char *cmd, char *parms)
G_ExitLevel();
C_HideConsoleFast();
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}

Expand Down Expand Up @@ -2598,7 +2598,7 @@ static void freeze_func2(char *cmd, char *parms)
C_Output(s_STSTR_FON);
HU_SetPlayerMessage(s_STSTR_FON, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();

mo->momx = 0;
Expand Down Expand Up @@ -3078,7 +3078,7 @@ static void give_func2(char *cmd, char *parms)
}

viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(parm);
}
Expand Down Expand Up @@ -3107,7 +3107,7 @@ static void god_func2(char *cmd, char *parms)
{
C_Output(s_STSTR_GODON);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -3543,7 +3543,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(temp);
}
Expand Down Expand Up @@ -3576,7 +3576,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(temp);
}
Expand Down Expand Up @@ -3641,7 +3641,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(temp);
}
Expand Down Expand Up @@ -3692,7 +3692,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -3758,7 +3758,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(temp);
}
Expand Down Expand Up @@ -3848,7 +3848,7 @@ static void kill_func2(char *cmd, char *parms)
C_HideConsole();
HU_SetPlayerMessage(buffer, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
free(temp);
}
Expand Down Expand Up @@ -4372,7 +4372,7 @@ static void map_func2(char *cmd, char *parms)
}

viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}

Expand Down Expand Up @@ -5326,7 +5326,7 @@ static void noclip_func2(char *cmd, char *parms)
C_Output(s_STSTR_NCON);
HU_SetPlayerMessage(s_STSTR_NCON, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -5377,7 +5377,7 @@ static void nomonsters_func2(char *cmd, char *parms)
C_Output(s_STSTR_NMON);
HU_SetPlayerMessage(s_STSTR_NMON, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -5431,7 +5431,7 @@ static void notarget_func2(char *cmd, char *parms)
C_Output(s_STSTR_NTON);
HU_SetPlayerMessage(s_STSTR_NTON, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -6105,7 +6105,7 @@ static void C_PlayerStats_Game(void)
free(temp2);

temp1 = commify(viewplayer->cheated);
temp2 = commifystat(stat_cheats);
temp2 = commifystat(stat_cheatsentered);
C_TabbedOutput(tabs, "Cheats entered\t%s\t%s", temp1, temp2);
free(temp1);
free(temp2);
Expand Down Expand Up @@ -6542,7 +6542,7 @@ static void C_PlayerStats_NoGame(void)
C_TabbedOutput(tabs, "Suicides\t\x96\t%s", temp1);
free(temp1);

temp1 = commifystat(stat_cheats);
temp1 = commifystat(stat_cheatsentered);
C_TabbedOutput(tabs, "Cheats entered\t\x96\t%s", temp1);
free(temp1);

Expand Down Expand Up @@ -6764,7 +6764,7 @@ static void regenhealth_func2(char *cmd, char *parms)
C_Output(s_STSTR_RHON);
HU_SetPlayerMessage(s_STSTR_RHON, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -6980,7 +6980,7 @@ static void C_VerifyResetAll(const int key)
for (int i = 0; i < NUMKEYS; i++)
keyactionlist[i][0] = '\0';

for (int i = 0; i < MAX_MOUSE_BUTTONS + 2; i++)
for (int i = 0; i < MAXMOUSEBUTTONS + 2; i++)
mouseactionlist[i][0] = '\0';

// reset stretched sky
Expand Down Expand Up @@ -7141,7 +7141,7 @@ static void respawnitems_func2(char *cmd, char *parms)
C_Output(s_STSTR_RION);
HU_SetPlayerMessage(s_STSTR_RION, false, false);
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
else
Expand Down Expand Up @@ -7454,7 +7454,7 @@ static void resurrect_func2(char *cmd, char *parms)
if (cheated)
{
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
}
Expand Down Expand Up @@ -7638,7 +7638,7 @@ static void spawn_func2(char *cmd, char *parms)
if (spawncmdfriendly)
{
thing->flags |= MF_FRIEND;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}

Expand All @@ -7659,7 +7659,7 @@ static void spawn_func2(char *cmd, char *parms)
{
if (flags & MF_COUNTITEM)
{
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}

Expand Down Expand Up @@ -8151,7 +8151,7 @@ static void teleport_func2(char *cmd, char *parms)
viewplayer->oldrecoil = 0;

viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();

if (z == ONFLOORZ)
Expand Down Expand Up @@ -8839,7 +8839,7 @@ static void am_path_func2(char *cmd, char *parms)
if (am_path)
{
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
}
Expand Down Expand Up @@ -10521,7 +10521,7 @@ static void turbo_func2(char *cmd, char *parms)
if (turbo > turbo_default)
{
viewplayer->cheated++;
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
}

M_SaveCVARs();
Expand Down
2 changes: 1 addition & 1 deletion src/c_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ void C_ShowConsole(void)
caretwait = 0;
skipaction = false;

for (int i = 0; i < MAX_MOUSE_BUTTONS; i++)
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
mousebuttons[i] = false;

if (gamestate == GS_LEVEL)
Expand Down
6 changes: 3 additions & 3 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ static void D_DoomMainSetup(void)
{
C_Output("A " BOLD("-nomonsters") " parameter was found on the command-line. "
"No monsters will now be spawned.");
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}

Expand Down Expand Up @@ -2105,7 +2105,7 @@ static void D_DoomMainSetup(void)

if (scale > turbo_default)
{
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
}
Expand Down Expand Up @@ -2555,7 +2555,7 @@ static void D_DoomMainSetup(void)

if (startmap > 1)
{
stat_cheats = SafeAdd(stat_cheats, 1);
stat_cheatsentered = SafeAdd(stat_cheatsentered, 1);
M_SaveCVARs();
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ bool gamekeydown[NUMKEYS] = { 0 };
char keyactionlist[NUMKEYS][255] = { "" };
static int turnheld; // for accelerative turning

static bool mousearray[MAX_MOUSE_BUTTONS + 1];
static bool mousearray[MAXMOUSEBUTTONS + 1];
bool *mousebuttons = &mousearray[1]; // allow [-1]
char mouseactionlist[MAX_MOUSE_BUTTONS + 2][255] = { "" };
char mouseactionlist[MAXMOUSEBUTTONS + 2][255] = { "" };

bool skipaction = false;

Expand Down Expand Up @@ -898,7 +898,7 @@ bool G_Responder(const event_t *ev)
{
const int mousebutton = ev->data1;

for (int i = 0, j = 1; i < MAX_MOUSE_BUTTONS; i++, j <<= 1)
for (int i = 0, j = 1; i < MAXMOUSEBUTTONS; i++, j <<= 1)
mousebuttons[i] = !!(mousebutton & j);

if (mousebuttons[mousealwaysrun])
Expand All @@ -909,9 +909,9 @@ bool G_Responder(const event_t *ev)

if (!automapactive && !menuactive && !paused && !freeze)
{
if (mousenextweapon < MAX_MOUSE_BUTTONS && mousebuttons[mousenextweapon])
if (mousenextweapon < MAXMOUSEBUTTONS && mousebuttons[mousenextweapon])
G_NextWeapon();
else if (mouseprevweapon < MAX_MOUSE_BUTTONS && mousebuttons[mouseprevweapon])
else if (mouseprevweapon < MAXMOUSEBUTTONS && mousebuttons[mouseprevweapon])
G_PrevWeapon();
}

Expand Down
2 changes: 1 addition & 1 deletion src/g_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ extern char lbmname1[MAX_PATH];
extern char lbmpath1[MAX_PATH];
extern char lbmpath2[MAX_PATH];
extern char keyactionlist[NUMKEYS][255];
extern char mouseactionlist[MAX_MOUSE_BUTTONS + 2][255];
extern char mouseactionlist[MAXMOUSEBUTTONS + 2][255];
extern int st_facecount;
extern bool skipaction;
extern char savename[MAX_PATH];
Expand Down
3 changes: 1 addition & 2 deletions src/i_gamecontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,13 @@ void I_ReadGameController(void)
|| gamecontrollerthumbRY
|| gamecontrollerbuttons != prevgamecontrollerbuttons)
{
event_t ev = { 0 };
event_t ev = { ev_controller, 0, 0, 0 };

if (gamestate != GS_LEVEL)
I_SaveMousePointerPosition();

keydown = 0;
usingmouse = false;
ev.type = ev_controller;
D_PostEvent(&ev);
}

Expand Down
7 changes: 2 additions & 5 deletions src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int mousepointerx, mousepointery;
// Bit mask of mouse button state
static unsigned int mousebuttonstate;

static const int buttons[MAX_MOUSE_BUTTONS + 1] =
static const int buttons[MAXMOUSEBUTTONS + 1] =
{
0x0000, 0x0001, 0x0004, 0x0002, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080
};
Expand Down Expand Up @@ -564,10 +564,7 @@ static void I_ReadMouse(void)

if (x || y || (mousebuttonstate != prevmousebuttonstate || (mousebuttonstate && menuactive)))
{
event_t ev = { 0 };

ev.type = ev_mouse;
ev.data1 = mousebuttonstate;
event_t ev = { ev_mouse, mousebuttonstate, 0, 0 };

if (((menuactive && !helpscreen) || consoleactive || gamestate == GS_TITLESCREEN)
&& !splashscreen && m_pointer)
Expand Down
2 changes: 1 addition & 1 deletion src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define MAXHEIGHT ((VANILLAHEIGHT + 1) * 2)
#define MAXSCREENAREA (MAXWIDTH * MAXHEIGHT)

#define MAX_MOUSE_BUTTONS 8
#define MAXMOUSEBUTTONS 8

#define GAMMALEVELS 21

Expand Down
6 changes: 3 additions & 3 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ bool weaponrecoil = weaponrecoil_default;

uint64_t stat_automapopened = 0;
uint64_t stat_barrelsexploded = 0;
uint64_t stat_cheats = 0;
uint64_t stat_cheatsentered = 0;
uint64_t stat_damageinflicted = 0;
uint64_t stat_damagereceived = 0;
uint64_t stat_deaths = 0;
Expand Down Expand Up @@ -467,7 +467,7 @@ static default_t cvars[] =
COMMENT("; player stats\n"),
CVAR_INT_UNSIGNED (automapopened, stat_automapopened, stat_automapopened, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (barrelsexploded, stat_barrelsexploded, stat_barrelsexploded, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (cheats, cheated, stat_cheats, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (cheatsentered, stat_cheats, stat_cheatsentered, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (damageinflicted, stat_damageinflicted, stat_damageinflicted, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (damagereceived, stat_damagereceived, stat_damagereceived, NOVALUEALIAS ),
CVAR_INT_UNSIGNED (deaths, stat_deaths, stat_deaths, NOVALUEALIAS ),
Expand Down Expand Up @@ -1055,7 +1055,7 @@ void M_LoadCVARs(char *filename)
for (int i = 0; i < NUMKEYS; i++)
keyactionlist[i][0] = '\0';

for (int i = 0; i < MAX_MOUSE_BUTTONS + 2; i++)
for (int i = 0; i < MAXMOUSEBUTTONS + 2; i++)
mouseactionlist[i][0] = '\0';
}

Expand Down
2 changes: 1 addition & 1 deletion src/m_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ extern bool weaponrecoil;

extern uint64_t stat_automapopened;
extern uint64_t stat_barrelsexploded;
extern uint64_t stat_cheats;
extern uint64_t stat_cheatsentered;
extern uint64_t stat_damageinflicted;
extern uint64_t stat_damagereceived;
extern uint64_t stat_deaths;
Expand Down
4 changes: 2 additions & 2 deletions src/p_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
#define MOUSE_LEFTBUTTON 1
#define MOUSE_RIGHTBUTTON 2

#define MOUSE_WHEELUP MAX_MOUSE_BUTTONS
#define MOUSE_WHEELDOWN (MAX_MOUSE_BUTTONS + 1)
#define MOUSE_WHEELUP MAXMOUSEBUTTONS
#define MOUSE_WHEELDOWN (MAXMOUSEBUTTONS + 1)

#define NEEDEDCARDFLASH 10

Expand Down
Loading

0 comments on commit 66acb9f

Please sign in to comment.