Compare commits

..
Author SHA1 Message Date
Alug 24163a7c92 Merge branch 'Saturn-Next' into controllerfixes 2025-11-11 14:53:40 +01:00
Alug d934197246 git merge pls 2025-11-11 14:49:11 +01:00
Alug bcd54110d5 only call netkeepalive between calls during gl precache
this caused some crashes in blankart, hopefully this is fine though
2025-11-11 14:19:11 +01:00
Alug 83d538b16a gl_viewludsin/viewludcos is only needed for sprite billboarding
which is not needed with shearing
2025-11-11 14:19:08 +01:00
Alug 2a6a7e1d2b smol optimization R_NoEncore
reuse secspecial for invertencore check
2025-11-11 14:19:06 +01:00
Alug c977c4fc45 initialize most of our global variables
just to be safe, not really trusting the game at this point, maybe this helps with some obscure bugs or smth lel
2025-11-11 14:19:02 +01:00
Alug 87e0b55f01 fix windowmoved never resetting 2025-11-09 19:13:49 +01:00
Alug 54f5b5ebfb enable software cyan pixel "cutting" for flats by default 2025-11-08 12:30:58 +01:00
Alug b421893646 call NetKeepAlive during ogl precache
should prevent timeouts on slower systems (*cough* *cough* windoze *cough*) hopefully
thx neppy for the idea!
2025-11-07 21:28:45 +01:00
Alug 237aeb7834 use early returns for "I_Finish" stuff
i like that more, less checks for stuff
2025-11-07 21:28:42 +01:00
Alug 7dbd95d556 Merge pull request #208 from Indev450/deletglseg
Remove OpenGL adjusted "segs"
2025-11-06 21:03:38 +01:00
Alug 1e4ba39691 Merge pull request #209 from Indev450/gammastuff
Port RR´s gamma correction + split gamma and brightness
2025-11-06 21:02:37 +01:00
Alug d4a130f1dc remove those memsets
not needed anymore now
2025-10-24 18:40:29 +02:00
Alug 8ccf4eb9ba this can be alot smoler 2025-10-24 18:40:25 +02:00
Alug cdb7b6fede initialize input events to something 2025-10-24 18:40:21 +02:00
Alug fcae072625 refactor controller dpad menu repeat handling
dont hack around manually checking for state checks
just use sdl provided stuff and poll if a dpad button currently is being held
2025-10-24 18:40:18 +02:00
Alug 1d3dae01e9 set SDL_HINT_AUTO_UPDATE_SENSORS hint to 0
we dont need any of that so disable it
2025-10-23 20:58:01 +02:00
Alug 736a626ccf init joyinfo in I_InitJoystick 2025-10-23 20:57:58 +02:00
Alug a4cc8b0585 keep track of joystick instance index
means we dont constantly need to refetch it
needs testing on windoze
2025-10-23 20:57:55 +02:00
Alug 333c94be52 clean up controller dpad input handling
just treat them as "normal" buttons instead of manually polling for them
alot cleaner and gets rid of yet another polling loop
also clean up some other stuff
needs to be tested with multiple controllers in splitscreen but cba to do that atm
2025-10-23 20:57:52 +02:00
Alug 21920112ee a thousand curses upon you polyobjects! 2025-10-02 18:37:18 +02:00
Alug 9b7bf5e7d8 Merge remote-tracking branch 'origin/Saturn-Next' into deletglseg 2025-10-02 18:00:59 +02:00
Alug 524168b20b experiment: remove opengl adjusted segs
in theory this should improve levelload times and reduce memory usage?
gotta see if it really does, visually so far there seems to be no difference at all
2025-10-02 17:57:52 +02:00
45 changed files with 557 additions and 720 deletions

No files matched your search

+19 -20
View File
@@ -78,14 +78,14 @@
#define MAX_REASONLENGTH 30
#define FORCECLOSE 0x8000
static long long unsigned packetstat[NUMPACKETTYPE+1] = {0};
static long long unsigned packetstat[NUMPACKETTYPE+1] = {};
boolean server = true; // true or false but !server == client
#define client (!server)
boolean nodownload = false;
boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
char motd[254] = {}, server_context[8] = {}; // Message of the Day, Unique Context (even without Mumble support)
#define MAP_ICON_REQUEST_FREQUENCY 8
@@ -98,14 +98,13 @@ static int map_icon_request_count; // current count of icon requests sent
static UINT8 *map_icon_data;
static patch_t *map_icon;
plrinfo playerinfo[MAXPLAYERS];
plrinfo playerinfo[MAXPLAYERS] = {};
SINT8 joinnode = 0; // used for CL_VIEWSERVER
boolean player_muted[MAXPLAYERS] = {0};
boolean player_muted[MAXPLAYERS] = {};
// Server specific vars
UINT8 playernode[MAXPLAYERS];
UINT8 playernode[MAXPLAYERS] = {};
// Minimum timeout for sending the savegame
// The actual timeout will be longer depending on the savegame length
@@ -118,15 +117,15 @@ static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can rese
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
UINT16 pingmeasurecount = 1;
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average will be sent to everyone.
UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values.
#define GENTLEMANSMOOTHING (TICRATE)
static tic_t reference_lag;
static UINT8 spike_time;
tic_t lowest_lag;
tic_t simulated_lag;
boolean server_lagless;
tic_t lowest_lag = 0;
tic_t simulated_lag = 0;
boolean server_lagless = true;
static void Lagless_OnChange(void)
{
@@ -144,12 +143,12 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL
consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz...
SINT8 nodetoplayer[MAXNETNODES];
SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen)
SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2)
SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 3)
UINT8 playerpernode[MAXNETNODES]; // used specialy for splitscreen
boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
SINT8 nodetoplayer[MAXNETNODES] = {};
SINT8 nodetoplayer2[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen)
SINT8 nodetoplayer3[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 2)
SINT8 nodetoplayer4[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 3)
UINT8 playerpernode[MAXNETNODES] = {}; // used specialy for splitscreen
boolean nodeingame[MAXNETNODES] = {}; // set false as nodes leave game
tic_t servermaxping = 20; // server's max delay, in frames. Defaults to 20
static tic_t nettics[MAXNETNODES]; // what tic the client have received
@@ -196,7 +195,7 @@ boolean is_client_saturn[MAXNETNODES];
static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD];
static tic_t neededtic;
SINT8 servernode = 0; // the number of the server node
char connectedservername[MAXSERVERNAME+1];
char connectedservername[MAXSERVERNAME+1] = {};
/// \brief do we accept new players?
/// \todo WORK!
boolean acceptnewnode = true;
@@ -227,7 +226,7 @@ struct textcmdbuf_s
static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL};
static ticcmd_t playercmds[MAXPLAYERS];
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS] = {};
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -285,7 +284,7 @@ static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n)
// Some software don't support largest packet
// (original sersetup, not exactely, but the probability of sending a packet
// of 512 bytes is like 0.1)
UINT16 software_MAXPACKETLENGTH;
UINT16 software_MAXPACKETLENGTH = 0;
/** Guesses the value of a tic from its lowest byte and from maketic
*
+10 -67
View File
@@ -142,8 +142,8 @@ static char addonsdir[MAX_WADPATH];
// Events can be discarded if no responder claims them
// referenced from i_system.c for I_GetKey()
event_t events[MAXEVENTS];
INT32 eventhead, eventtail;
event_t events[MAXEVENTS] = {};
INT32 eventhead = 0, eventtail = 0;
boolean dedicated = false;
@@ -161,68 +161,17 @@ void D_PostEvent(const event_t *ev)
// modifier keys
// Now handled in I_OsPolling
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
static void D_PadMenuScrollInput(UINT8 input)
{
event_t dpadev;
memset(&dpadev, 0, sizeof(event_t));
dpadev.type = ev_keydown;
switch (input)
{
case DPAD_UP:
dpadev.data1 = KEY_UPARROW;
break;
case DPAD_DOWN:
dpadev.data1 = KEY_DOWNARROW;
break;
case DPAD_LEFT:
dpadev.data1 = KEY_LEFTARROW;
break;
case DPAD_RIGHT:
dpadev.data1 = KEY_RIGHTARROW;
break;
}
D_PostEvent(&dpadev); // put into eventlist
}
#define SCROLLDELAY 19
// Check if any dpad button is held
// and pass it to the eventlist
static void D_GamePadMenuScrollTicker(void)
{
UINT8 i;
static UINT8 menuInputDelayTimer = 0;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (dpadscrollstate[i])
{
if (menuInputDelayTimer < SCROLLDELAY)
menuInputDelayTimer++;
else if (menuInputDelayTimer == SCROLLDELAY)
D_PadMenuScrollInput(i);
return;
}
}
menuInputDelayTimer = 0;
}
#undef SCROLLDELAY
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {};
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
static UINT16 color[MAXSPLITSCREENPLAYERS] = {};
if (numcontrollers == 0)
{
@@ -390,8 +339,7 @@ static void D_Renderview(void)
}
else if (rendermode == render_soft)
#endif
R_RenderPlayerView(&players[displayplayers[i]]);
R_RenderPlayerView(&players[displayplayers[i]]);
}
if (rendermode == render_soft)
@@ -720,7 +668,7 @@ static boolean D_Display(void)
// D_SRB2Loop
// =========================================================================
tic_t rendergametic;
tic_t rendergametic = 0;
void D_SRB2Loop(void)
{
@@ -845,11 +793,6 @@ void D_SRB2Loop(void)
if (!dedicated)
{
if (menuactive)
{
D_GamePadMenuScrollTicker();
}
D_DeviceLEDTick();
}
}
+3 -3
View File
@@ -95,9 +95,9 @@ static INT32 sendackpacket = 0, getackpacket = 0;
INT32 ticruned = 0, ticmiss = 0;
// globals
INT32 getbps, sendbps;
float lostpercent, duppercent, gamelostpercent;
INT32 packetheaderlength;
INT32 getbps = 0, sendbps = 0;
float lostpercent = 0, duppercent = 0, gamelostpercent = 0;
INT32 packetheaderlength = 0;
boolean Net_GetNetStat(void)
{
+4 -4
View File
@@ -110,14 +110,14 @@ static fileused_t transferFiles[UINT8_MAX + 1];
// Write time of file: utime
// Receiver structure
INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
INT32 fileneedednum = 0; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
#ifdef HAVE_THREADS
static I_mutex downloadmutex;
#endif
char downloaddir[512] = "DOWNLOAD";
file_download_t filedownload;
file_download_t filedownload = {};
#ifdef HAVE_CURL
static CURL *http_handle;
@@ -131,7 +131,7 @@ static UINT32 curl_origfilesize;
static UINT32 curl_origtotalfilesize;
static char *curl_realname = NULL;
fileneeded_t *curl_curfile = NULL;
HTTP_login *curl_logins;
HTTP_login *curl_logins = NULL;
#endif
/** Fills a serverinfo packet with information about wad files loaded.
+3 -3
View File
@@ -68,8 +68,8 @@ UINT8 numDemos = 0; //3; -- i'm FED UP of losing my skincolour to a broken
UINT32 demoDelayTime = 15*TICRATE;
UINT32 demoIdleTime = 3*TICRATE;
boolean nodrawers; // for comparative timing purposes
boolean noblit; // for comparative timing purposes
boolean nodrawers = false; // for comparative timing purposes
boolean noblit = false; // for comparative timing purposes
static tic_t demostarttime; // for comparative timing purposes
//@TODO put these all in a struct for namespacing purposes?
@@ -80,7 +80,7 @@ static UINT8 *demoend;
static UINT8 demoflags;
static boolean demosynced = true; // console warning message
struct demovars_s demo;
struct demovars_s demo = {};
consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+88 -89
View File
@@ -59,15 +59,15 @@
#include "discord.h"
#endif
gameaction_t gameaction;
gameaction_t gameaction = 0;
gamestate_t gamestate = GS_NULL;
UINT8 ultimatemode = false;
boolean botingame;
UINT8 botskin;
UINT8 botcolor;
boolean botingame = false;
UINT8 botskin = 0;
UINT8 botcolor = 0;
JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
JoyType_t Joystick[MAXSPLITSCREENPLAYERS] = {};
// 1024 bytes is plenty for a savegame
#define SAVEGAMESIZE (1024)
@@ -83,10 +83,10 @@ static void G_DoContinued(void);
static void G_DoWorldDone(void);
static void G_DoStartVote(void);
music_t mapmusic;
music_t mapmusic = {};
INT16 gamemap = 1;
INT16 maptol;
INT16 maptol = 0;
UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE;
INT32 cursaveslot = -1; // Auto-save 1p savegame slot
@@ -97,29 +97,29 @@ UINT16 mainwads = 0;
boolean modifiedgame = false; // Set if homebrew PWAD stuff has been added.
boolean majormods = false; // Set if Lua/Gameplay SOC/replacement map has been added.
boolean savemoddata = false;
UINT8 paused;
UINT8 paused = 0;
UINT8 modeattacking = ATTACKING_NONE;
boolean imcontinuing = false;
boolean runemeraldmanager = false;
boolean netgame; // only true if packets are broadcast
boolean multiplayer;
boolean playeringame[MAXPLAYERS];
boolean addedtogame;
player_t players[MAXPLAYERS];
boolean netgame = false; // only true if packets are broadcast
boolean multiplayer = false;
boolean playeringame[MAXPLAYERS] = {};
boolean addedtogame = false;
player_t players[MAXPLAYERS] = {};
INT32 consoleplayer; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed
INT32 consoleplayer = 0; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed
tic_t gametic;
tic_t levelstarttic; // gametic at level start
UINT32 totalrings; // for intermission
INT16 lastmap; // last level you were at (returning from special stages)
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
tic_t gametic = 0;
tic_t levelstarttic = 0; // gametic at level start
UINT32 totalrings = 0; // for intermission
INT16 lastmap = 0; // last level you were at (returning from special stages)
tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display)
INT16 spstage_start;
INT16 sstage_start;
INT16 sstage_end;
INT16 spstage_start = 0;
INT16 sstage_start = 0;
INT16 sstage_end = 0;
boolean looptitle = true;
boolean useNightsSS = false;
@@ -134,42 +134,42 @@ boolean countdowntimeup = false;
cutscene_t *cutscenes[128];
INT16 nextmapoverride;
boolean skipstats;
INT16 nextmapoverride = 0;
boolean skipstats = false;
// Pointers to each CTF flag
mobj_t *redflag;
mobj_t *blueflag;
mobj_t *redflag = NULL;
mobj_t *blueflag = NULL;
// Pointers to CTF spawn location
mapthing_t *rflagpoint;
mapthing_t *bflagpoint;
mapthing_t *rflagpoint = NULL;
mapthing_t *bflagpoint = NULL;
struct quake quake;
// Map Header Information
mapheader_t* mapheaderinfo[NUMMAPS] = {NULL};
mapheader_t* mapheaderinfo[NUMMAPS] = {};
static boolean exitgame = false;
static boolean retrying = false;
UINT8 stagefailed; // Used for GEMS BONUS? Also to see if you beat the stage.
UINT8 stagefailed = 0; // Used for GEMS BONUS? Also to see if you beat the stage.
UINT16 emeralds;
UINT32 token; // Number of tokens collected in a level
UINT32 tokenlist; // List of tokens collected
INT32 tokenbits; // Used for setting token bits
UINT16 emeralds = 0;
UINT32 token = 0; // Number of tokens collected in a level
UINT32 tokenlist = 0; // List of tokens collected
INT32 tokenbits = 0; // Used for setting token bits
// Old Special Stage
INT32 sstimer; // Time allotted in the special stage
INT32 sstimer = 0; // Time allotted in the special stage
boolean gamedataloaded = false;
// Time attack data for levels
// These are dynamically allocated for space reasons now
recorddata_t *mainrecords[NUMMAPS] = {NULL};
UINT8 mapvisited[NUMMAPS];
recorddata_t *mainrecords[NUMMAPS] = {};
UINT8 mapvisited[NUMMAPS] = {};
UINT32 bluescore, redscore; // CTF and Team Match team scores
UINT32 bluescore = 0, redscore = 0; // CTF and Team Match team scores
// ring count... for PERFECT!
INT32 nummaprings = 0;
@@ -179,12 +179,12 @@ INT32 nummapboxes = 0;
INT32 numgotboxes = 0;
// Elminates unnecessary searching.
boolean CheckForBustableBlocks;
boolean CheckForBouncySector;
boolean CheckForQuicksand;
boolean CheckForMarioBlocks;
boolean CheckForFloatBob;
boolean CheckForReverseGravity;
boolean CheckForBustableBlocks = false;
boolean CheckForBouncySector = false;
boolean CheckForQuicksand = false;
boolean CheckForMarioBlocks = false;
boolean CheckForFloatBob = false;
boolean CheckForReverseGravity = false;
// Powerup durations
UINT16 invulntics = 20*TICRATE;
@@ -215,67 +215,66 @@ INT32 gameovertics = 15*TICRATE;
UINT8 use1upSound = 0;
UINT8 maxXtraLife = 2; // Max extra lives from rings
UINT8 introtoplay;
UINT8 creditscutscene;
UINT8 introtoplay = 0;
UINT8 creditscutscene = 0;
// Emerald locations
mobj_t *hunt1;
mobj_t *hunt2;
mobj_t *hunt3;
mobj_t *hunt1 = NULL;
mobj_t *hunt2 = NULL;
mobj_t *hunt3 = NULL;
tic_t racecountdown, exitcountdown; // for racing
tic_t racecountdown = 0, exitcountdown = 0; // for racing
fixed_t gravity;
fixed_t mapobjectscale;
fixed_t gravity = 0;
fixed_t mapobjectscale = FRACUNIT;
struct maplighting maplighting;
INT16 autobalance; //for CTF team balance
INT16 teamscramble; //for CTF team scramble
INT16 scrambleplayers[MAXPLAYERS]; //for CTF team scramble
INT16 scrambleteams[MAXPLAYERS]; //for CTF team scramble
INT16 scrambletotal; //for CTF team scramble
INT16 scramblecount; //for CTF team scramble
INT16 autobalance = 0; //for CTF team balance
INT16 teamscramble = 0; //for CTF team scramble
INT16 scrambleplayers[MAXPLAYERS] = {}; //for CTF team scramble
INT16 scrambleteams[MAXPLAYERS] = {}; //for CTF team scramble
INT16 scrambletotal = 0; //for CTF team scramble
INT16 scramblecount = 0; //for CTF team scramble
INT32 cheats; //for multiplayer cheat commands
INT32 cheats = 0; //for multiplayer cheat commands
// SRB2Kart
// Cvars that we don't want changed mid-game
UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard
UINT8 gamespeed = 0; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard
boolean encoremode = false; // Encore Mode currently enabled?
boolean prevencoremode;
boolean franticitems; // Frantic items currently enabled?
boolean comeback; // Battle Mode's karma comeback is on/off
boolean prevencoremode = 0;
boolean franticitems = 0; // Frantic items currently enabled?
boolean comeback = 0; // Battle Mode's karma comeback is on/off
// Voting system
INT16 votelevels[4][2]; // Levels that were rolled by the host
SINT8 votes[MAXPLAYERS]; // Each player's vote
SINT8 pickedvote; // What vote the host rolls
INT16 votelevels[4][2] = {}; // Levels that were rolled by the host
SINT8 votes[MAXPLAYERS] = {}; // Each player's vote
SINT8 pickedvote = 0; // What vote the host rolls
// Server-sided, synched variables
SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points
tic_t wantedcalcdelay; // Time before it recalculates WANTED
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled
tic_t mapreset; // Map reset delay when enough players have joined an empty game
UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing
boolean thwompsactive; // Thwomps activate on lap 2
SINT8 spbplace; // SPB exists, give the person behind better items
boolean startedInFreePlay; // Map was started in free play
SINT8 battlewanted[4] = {}; // WANTED players in battle, worth x2 points
tic_t wantedcalcdelay = 0; // Time before it recalculates WANTED
tic_t indirectitemcooldown = 0; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
tic_t hyubgone = 0; // Cooldown before hyudoro is allowed to be rerolled
tic_t mapreset = 0; // Map reset delay when enough players have joined an empty game
UINT8 nospectategrief = 0; // How many players need to be in-game to eliminate last; for preventing spectate griefing
boolean thwompsactive = 0; // Thwomps activate on lap 2
SINT8 spbplace = 0; // SPB exists, give the person behind better items
boolean startedInFreePlay = false; // Map was started in free play
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
boolean legitimateexit; // Did this client actually finish the match?
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to roll
boolean legitimateexit = 0; // Did this client actually finish the match?
boolean comebackshowninfo = 0; // Have you already seen the "ATTACK OR PROTECT" message?
static INT16 randmapbuffer[NUMMAPS+1] = {}; // Buffer for maps RandMap is allowed to roll
tic_t hidetime;
tic_t hidetime = 0;
// Grading
UINT32 timesBeaten;
UINT32 timesBeatenWithEmeralds;
//UINT32 timesBeatenUltimate;
UINT32 timesBeaten = 0;
UINT32 timesBeatenWithEmeralds = 0;
INT16 prevmap, nextmap;
INT16 prevmap = 0, nextmap = 0;
// Analog Control
void SendWeaponPref(void);
@@ -470,7 +469,7 @@ consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, cechotoggle_t, NULL, 0,
#endif
#ifdef SEENAMES
player_t *seenplayer; // player we're aiming at right now
player_t *seenplayer = NULL; // player we're aiming at right now
#endif
char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
@@ -493,7 +492,7 @@ char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
"Player 16"
}; // SRB2kart - removed Players 17 through 32
INT32 player_name_changes[MAXPLAYERS];
INT32 player_name_changes[MAXPLAYERS] = {};
INT16 rw_maximums[NUM_WEAPONS] =
{
@@ -797,9 +796,9 @@ boolean InputDown(INT32 gc, UINT8 p)
}
}
INT32 localaiming[MAXSPLITSCREENPLAYERS] = {0};
angle_t localangle[MAXSPLITSCREENPLAYERS] = {0};
boolean camspin[MAXSPLITSCREENPLAYERS] = {0};
INT32 localaiming[MAXSPLITSCREENPLAYERS] = {};
angle_t localangle[MAXSPLITSCREENPLAYERS] = {};
boolean camspin[MAXSPLITSCREENPLAYERS] = {};
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
-3
View File
@@ -262,9 +262,6 @@ void G_ResetControls(void)
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
// reset those just in case the game missed the keyup event
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
}
//
+1 -1
View File
@@ -37,7 +37,7 @@ typedef enum
KEY_JOY1 = KEY_MOUSE1 + MOUSEBUTTONS,
KEY_HAT1 = KEY_JOY1 + JOYBUTTONS,
KEY_DBLMOUSE1 =KEY_HAT1 + JOYHATS*4, // double clicks
KEY_DBLMOUSE1 = KEY_HAT1 + JOYHATS*4, // double clicks
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
-103
View File
@@ -80,14 +80,6 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
return p;
}
static polyvertex_t *HWR_AllocVertex(void)
{
polyvertex_t *p;
size_t size = sizeof(polyvertex_t);
p = Z_Malloc(size, PU_HWRPLANE, NULL);
return p;
}
/// \todo polygons should be freed in reverse order for efficiency,
/// for now don't free because it doesn't free in reverse order
static void HWR_FreePoly(poly_t *poly)
@@ -855,100 +847,6 @@ static INT32 SolveTProblem(void)
return numsplitpoly;
}
#define NEARDIST (0.75f)
#define MYMAX (10000000000000.0f)
/* Adjust true segs (from the segs lump) to be exactely the same as
* plane polygone segs
* This also convert fixed_t point of segs in float (in moste case
* it share the same vertice
*/
static void AdjustSegs(void)
{
size_t i, count;
INT32 j;
seg_t *lseg;
poly_t *p;
INT32 v1found = 0, v2found = 0;
float nearv1, nearv2;
for (i = 0; i < numsubsectors; i++)
{
count = subsectors[i].numlines;
lseg = &segs[subsectors[i].firstline];
p = extrasubsectors[i].planepoly;
if (!p)
continue;
for (; count--; lseg++)
{
float distv1,distv2,tmp;
nearv1 = nearv2 = MYMAX;
// Don't touch polyobject segs. We'll compensate
// for this when we go about drawing them.
if (lseg->polyseg)
continue;
for (j = 0; j < p->numpts; j++)
{
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
distv1 = distv1*distv1+tmp*tmp;
if (distv1 <= nearv1)
{
v1found = j;
nearv1 = distv1;
}
// the same with v2
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
distv2 = distv2*distv2+tmp*tmp;
if (distv2 <= nearv2)
{
v2found = j;
nearv2 = distv2;
}
}
if (nearv1 <= NEARDIST*NEARDIST)
// share vertice with segs
lseg->pv1 = &(p->pts[v1found]);
else
{
// BP: here we can do better, using PointInSeg and compute
// the right point position also split a polygone side to
// solve a T-intersection, but too mush work
// convert fixed vertex to float vertex
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
lseg->pv1 = pv;
}
if (nearv2 <= NEARDIST*NEARDIST)
lseg->pv2 = &(p->pts[v2found]);
else
{
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
lseg->pv2 = pv;
}
lseg->pv1->x2 = FloatToFixed(lseg->pv1->x);
lseg->pv1->y2 = FloatToFixed(lseg->pv1->y);
lseg->pv2->x2 = FloatToFixed(lseg->pv2->x);
lseg->pv2->y2 = FloatToFixed(lseg->pv2->y);
}
}
}
// call this routine after the BSP of a Doom wad file is loaded,
// and it will generate all the convex polys for the hardware renderer
@@ -1017,7 +915,6 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#else
SolveTProblem();
#endif
AdjustSegs();
#ifdef DEBUG_HWBSP
//debug debug..
+9
View File
@@ -818,11 +818,20 @@ void HWR_PrecacheLevel(void)
// Precache flats.
HWR_PrecacheLevelFlats();
// prevent timeouts
NetKeepAlive();
// Precache textures.
HWR_PrecacheLevelTextures();
// prevent timeouts
NetKeepAlive();
// Precache sprites.
//HWR_PrecacheLevelSprites();
// prevent timeouts
//NetKeepAlive();
}
void HWR_LoadMapTextures(size_t pnumtextures)
+6 -7
View File
@@ -80,14 +80,13 @@
typedef struct clipnode_s
{
struct clipnode_s *prev, *next;
angle_t start, end;
} clipnode_t;
{
struct clipnode_s *prev, *next;
angle_t start, end;
} clipnode_t;
clipnode_t *freelist;
clipnode_t *clipnodes;
clipnode_t *cliphead;
static clipnode_t *freelist;
static clipnode_t *cliphead;
static clipnode_t * gld_clipnode_GetNew(void);
static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end);
+1 -1
View File
@@ -117,7 +117,7 @@ typedef struct
typedef struct
{
FLOAT x,y,z; // position
FLOAT x, y, z; // position
FLOAT anglex, angley, anglez; // aimingangle / viewangle
FLOAT scalex, scaley, scalez;
FLOAT fovangle;
+48 -97
View File
@@ -75,19 +75,19 @@ boolean gl_drawing_stencil = false;
static INT32 current_bsp_culling_distance = 0;
FTransform atransform;
FTransform atransform = {};
// Float variants of viewx, viewy, viewz, etc.
static float gl_viewx, gl_viewy, gl_viewz;
float gl_viewsin, gl_viewcos;
float gl_viewsin = 0.0f, gl_viewcos = 0.0f;
static float gl_viewludsin, gl_viewludcos;
static angle_t gl_aimingangle;
seg_t *gl_curline;
side_t *gl_sidedef;
line_t *gl_linedef;
sector_t *gl_frontsector;
sector_t *gl_backsector;
seg_t *gl_curline = NULL;
side_t *gl_sidedef = NULL;
line_t *gl_linedef = NULL;
sector_t *gl_frontsector = NULL;
sector_t *gl_backsector = NULL;
// values for the far clipping plane
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
@@ -728,6 +728,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
for (i = 0; i < subsector->numlines; i++, line++)
{
if (line->polyseg)
continue;
line_t* ld = line->linedef;
// this check sucks and is a hotspot lel
@@ -740,27 +743,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
P_ClosestPointOnLine(viewx, viewy, ld, &v);
dist = FixedToFloat(R_PointToDist(v.x, v.y));
if (line->pv1)
{
x1 = line->pv1->x;
y1 = line->pv1->y;
}
else
{
x1 = FixedToFloat(line->v1->x);
y1 = FixedToFloat(line->v1->y);
}
x1 = (line->fv1.x);
y1 = (line->fv1.y);
if (line->pv2)
{
xd = line->pv2->x - x1;
yd = line->pv2->y - y1;
}
else
{
xd = FixedToFloat(line->v2->x) - x1;
yd = FixedToFloat(line->v2->y) - y1;
}
xd = (line->fv2.x) - x1;
yd = (line->fv2.y) - y1;
// Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion
dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f;
@@ -824,11 +811,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
M_ClearBox(segbbox);
M_AddToBox(segbbox,
FloatToFixed(gl_curline->pv1->x),
FloatToFixed(gl_curline->pv1->y));
FloatToFixed(gl_curline->fv1.x),
FloatToFixed(gl_curline->fv1.y));
M_AddToBox(segbbox,
FloatToFixed(gl_curline->pv2->x),
FloatToFixed(gl_curline->pv2->y));
FloatToFixed(gl_curline->fv2.x),
FloatToFixed(gl_curline->fv2.y));
splat = (wallsplat_t *)gl_curline->linedef->splats;
for (; splat; splat = splat->next)
@@ -1319,34 +1306,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const boolean noencore = (gl_linedef->flags & ML_TFERLINE);
if (LIKELY(gl_curline->pv1))
{
vs.x = gl_curline->pv1->x;
vs.y = gl_curline->pv1->y;
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
vs.x = FixedToFloat(gl_curline->v1->x);
vs.y = FixedToFloat(gl_curline->v1->y);
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
if (LIKELY(gl_curline->pv2))
if (gl_curline->polyseg)
{
ve.x = gl_curline->pv2->x;
ve.y = gl_curline->pv2->y;
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
vs.x = FixedToFloat(v1x);
vs.y = FixedToFloat(v1y);
ve.x = FixedToFloat(v2x);
ve.y = FixedToFloat(v2y);
}
else
{
ve.x = FixedToFloat(gl_curline->v2->x);
ve.y = FixedToFloat(gl_curline->v2->y);
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
vs.x = gl_curline->fv1.x;
vs.y = gl_curline->fv1.y;
ve.x = gl_curline->fv2.x;
ve.y = gl_curline->fv2.y;
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
@@ -2198,27 +2175,11 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
if (LIKELY(gl_curline->pv1))
{
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
if (LIKELY(gl_curline->pv2))
{
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
end1 = P_GetZAt(slope, v1x, v1y, normalheight); \
@@ -2423,27 +2384,11 @@ static void HWR_AddLine(seg_t *line)
gl_curline = line;
if (LIKELY(gl_curline->pv1))
{
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
if (LIKELY(gl_curline->pv2))
{
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
// OPTIMIZE: quickly reject orthogonal back sides.
angle1 = R_PointToAngle64(v1x, v1y);
@@ -3529,7 +3474,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip, const boolean papersprite)
{
if (!cv_glspritebillboarding.value || papersprite)
if (!cv_glspritebillboarding.value || cv_glshearing.value || papersprite)
{
return;
}
@@ -5365,8 +5310,12 @@ void HWR_SetTransform(float fpov)
HWR_SetTransformAiming(&atransform);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
// only needed for sprite billboarding
if (cv_glspritebillboarding.value && !cv_glshearing.value)
{
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
}
atransform.fovangle = fpov; // Tails
HWR_RollTransform(&atransform, viewroll);
@@ -5382,7 +5331,9 @@ void HWR_SetTransform(float fpov)
atransform.fliptype = TRANSFORM_FLIP;
}
else if (postimg & POSTIMG_MIRROR)
{
atransform.fliptype = TRANSFORM_MIRROR;
}
// Set transform.
GL_SetTransform(&atransform);
+3 -4
View File
@@ -72,10 +72,9 @@
#include <errno.h>
#endif
md2_t md2_models[NUMSPRITES];
md2_t md2_playermodels[MAXSKINS];
md2_t md2_localplayermodels[MAXLOCALSKINS];
md2_t md2_models[NUMSPRITES] = {};
md2_t md2_playermodels[MAXSKINS] = {};
md2_t md2_localplayermodels[MAXLOCALSKINS] = {};
/*
* free model
+3 -1
View File
@@ -30,7 +30,7 @@
SINT8 gl_portal_state = GLPORTAL_OFF;
gl_portallist_t *currentportallist;
gl_portallist_t *currentportallist = NULL;
// clip the area outside the portal destination window
void HWR_PortalClipping(gl_portal_t *portal)
@@ -168,8 +168,10 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
// go to portal frame lmao
HWR_PortalFrame(portal);
// call HWR_RenderViewpoint
HWR_RenderPortalViewpoint(portal, player, stencil_level + 1, true);
// return to current frame
if (rootportal)
HWR_PortalFrame(rootportal);
-4
View File
@@ -221,10 +221,6 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
*/
const char *I_LocateWad(void);
/** \brief Joystick events
*/
void I_GetJoystickEvents(UINT8 index);
char *I_GetEnv(const char *name);
INT32 I_PutEnv(char *variable);
+2
View File
@@ -143,6 +143,8 @@ boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
void I_HandleControllerHatRepeat(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
+3 -24
View File
@@ -759,8 +759,6 @@ static void Command_Manual_f(void)
itemOn = 0;
}
boolean dpadscrollstate[4] = {false, false, false, false};
//
// M_Responder
//
@@ -807,19 +805,15 @@ boolean M_Responder(event_t *ev)
break;
case KEY_HAT1:
ch = KEY_UPARROW;
dpadscrollstate[DPAD_UP] = true;
break;
case KEY_HAT1 + 1:
ch = KEY_DOWNARROW;
dpadscrollstate[DPAD_DOWN] = true;
break;
case KEY_HAT1 + 2:
ch = KEY_LEFTARROW;
dpadscrollstate[DPAD_LEFT] = true;
break;
case KEY_HAT1 + 3:
ch = KEY_RIGHTARROW;
dpadscrollstate[DPAD_RIGHT] = true;
break;
}
@@ -835,24 +829,6 @@ boolean M_Responder(event_t *ev)
}
}
}
else if (ev->type == ev_keyup)
{
switch (ev->data1) // if you let go of those set those to false
{
case KEY_HAT1:
dpadscrollstate[DPAD_UP] = false;
break;
case KEY_HAT1 + 1:
dpadscrollstate[DPAD_DOWN] = false;
break;
case KEY_HAT1 + 2:
dpadscrollstate[DPAD_LEFT] = false;
break;
case KEY_HAT1 + 3:
dpadscrollstate[DPAD_RIGHT] = false;
break;
}
}
else if (menuactive)
{
tic_t thistime = I_GetTime();
@@ -1731,6 +1707,9 @@ void M_Ticker(void)
if (dedicated)
return;
if (menuactive)
I_HandleControllerHatRepeat();
if (--skullAnimCounter <= 0)
skullAnimCounter = 8;
-10
View File
@@ -38,16 +38,6 @@ extern boolean forceshowhud;
// Does all the real work of the menu interaction.
boolean M_Responder(event_t *ev);
// for scrolling through menus with controllers
extern boolean dpadscrollstate[4];
enum
{
DPAD_UP,
DPAD_DOWN,
DPAD_LEFT,
DPAD_RIGHT
};
// Called by main loop, runs for demo playback. If this returns true, nullify any further user input.
boolean M_DemoResponder(event_t *ev);
+2 -2
View File
@@ -28,8 +28,8 @@
boolean LUA_CallAction(enum actionnum actionnum, void *thing);
INT32 var1;
INT32 var2;
INT32 var1 = 0;
INT32 var2 = 0;
//
// P_NewChaseDir related LUT.
+13 -13
View File
@@ -41,32 +41,32 @@
#include "m_perfstats.h" // ps_checkposition_calls
fixed_t tmbbox[4];
mobj_t *tmthing;
fixed_t tmbbox[4] = {};
mobj_t *tmthing = NULL;
static INT32 tmflags;
fixed_t tmx;
fixed_t tmy;
fixed_t tmx = 0;
fixed_t tmy = 0;
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
boolean floatok;
boolean floatok = false;
fixed_t tmfloorz, tmceilingz;
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
pslope_t *tmfloorslope, *tmceilingslope;
fixed_t tmfloorz = 0, tmceilingz = 0;
static fixed_t tmdropoffz = 0, tmdrpoffceilz = 0; // drop-off floor/ceiling heights
mobj_t *tmfloorthing = NULL; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
mobj_t *tmhitthing = NULL; // the solid thing you bumped into (for collisions)
pslope_t *tmfloorslope = NULL, *tmceilingslope = NULL;
// keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls
line_t *ceilingline;
line_t *ceilingline = NULL;
// set by PIT_CheckLine() for any line that stopped the PIT_CheckLine()
// that is, for any line which is 'solid'
line_t *blockingline;
line_t *blockingline = NULL;
msecnode_t *sector_list = NULL;
camera_t *mapcampointer;
camera_t *mapcampointer = NULL;
//
// TELEPORT MOVE
+1 -1
View File
@@ -43,7 +43,7 @@
consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
actioncache_t actioncachehead;
actioncache_t actioncachehead = {};
static mobj_t *overlaycap = NULL;
static mobj_t *shadowcap = NULL;
+1 -1
View File
@@ -35,7 +35,7 @@
#include "lua_script.h"
#include "p_slopes.h"
savedata_t savedata;
savedata_t savedata = {};
// Block UINT32s to attempt to ensure that the correct data is
// being sent and received
+39 -28
View File
@@ -92,7 +92,7 @@
// Map MD5, calculated on level load.
// Sent to clients in PT_SERVERINFO.
//
unsigned char mapmd5[16];
unsigned char mapmd5[16] = {};
// true when level was loaded from netsave
boolean midgamejoin = false;
@@ -102,22 +102,22 @@ boolean midgamejoin = false;
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
//
size_t numvertexes, numsegs, numsectors, numsubsectors, numnodes, numlines, numsides, nummapthings;
vertex_t *vertexes;
seg_t *segs;
sector_t *sectors;
subsector_t *subsectors;
node_t *nodes;
line_t *lines;
side_t *sides;
mapthing_t *mapthings;
sector_t *spawnsectors;
line_t *spawnlines;
side_t *spawnsides;
INT32 numstarposts;
boolean levelloading;
size_t numvertexes = 0, numsegs = 0, numsectors = 0, numsubsectors = 0, numnodes = 0, numlines = 0, numsides = 0, nummapthings = 0;
vertex_t *vertexes = NULL;
seg_t *segs = NULL;
sector_t *sectors = NULL;
subsector_t *subsectors = NULL;
node_t *nodes = NULL;
line_t *lines = NULL;
side_t *sides = NULL;
mapthing_t *mapthings = NULL;
sector_t *spawnsectors = NULL;
line_t *spawnlines = NULL;
side_t *spawnsides = NULL;
INT32 numstarposts = 0;
boolean levelloading = false;
virtres_t *curmapvirt;
virtres_t *curmapvirt = NULL;
// BLOCKMAP
// Created from axis aligned bounding box
@@ -127,32 +127,32 @@ virtres_t *curmapvirt;
// by spatial subdivision in 2D.
//
// Blockmap size.
INT32 bmapwidth, bmapheight; // size in mapblocks
INT32 bmapwidth = 0, bmapheight = 0; // size in mapblocks
INT32 *blockmap; // INT32 for large maps
INT32 *blockmap = NULL; // INT32 for large maps
// offsets in blockmap are from here
INT32 *blockmaplump; // Big blockmap
INT32 *blockmaplump = NULL; // Big blockmap
// origin of block map
fixed_t bmaporgx, bmaporgy;
fixed_t bmaporgx = 0, bmaporgy = 0;
// for thing chains
mobj_t **blocklinks;
precipmobj_t **precipblocklinks;
mobj_t **blocklinks = NULL;
precipmobj_t **precipblocklinks = NULL;
// REJECT
// For fast sight rejection.
// Speeds up enemy AI by skipping detailed LineOf Sight calculation.
// Without special effect, this could be used as a PVS lookup as well.
//
UINT8 *rejectmatrix;
UINT8 *rejectmatrix = NULL;
// Maintain single and multi player starting spots.
INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts;
INT32 numdmstarts = 0, numcoopstarts = 0, numredctfstarts = 0, numbluectfstarts = 0;
mapthing_t *deathmatchstarts[MAX_DM_STARTS];
mapthing_t *playerstarts[MAXPLAYERS];
mapthing_t *bluectfstarts[MAXPLAYERS];
mapthing_t *redctfstarts[MAXPLAYERS];
mapthing_t *deathmatchstarts[MAX_DM_STARTS] = {};
mapthing_t *playerstarts[MAXPLAYERS] = {};
mapthing_t *bluectfstarts[MAXPLAYERS] = {};
mapthing_t *redctfstarts[MAXPLAYERS] = {};
// Global state for PartialAddWadFile/MultiSetupWadFiles
// Might be replacable with parameters, but non-trivial when the functions are called on separate tics
@@ -544,7 +544,18 @@ static void P_LoadSegs(UINT8 *data)
{
li->v1 = &vertexes[SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)];
#ifdef HWRENDER
if (rendermode == render_opengl)
{
li->fv1.x = FixedToFloat(li->v1->x);
li->fv1.y = FixedToFloat(li->v1->y);
//li->fv1.z = FixedToFloat(li->v1->z); // z is unused in gl
li->fv2.x = FixedToFloat(li->v2->x);
li->fv2.y = FixedToFloat(li->v2->y);
//li->fv2.z = FixedToFloat(li->v2->z);
}
#endif
li->length = P_SegLength(li);
li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS;
+2 -2
View File
@@ -44,7 +44,7 @@
// Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog
#include <errno.h>
mobj_t *skyboxmo[2];
mobj_t *skyboxmo[2] = {};
// Amount (dx, dy) vector linedef is shifted right to get scroll amount
#define SCROLL_SHIFT 5
@@ -93,7 +93,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer);
//SoM: 3/7/2000: New sturcture without limits.
anim_t *lastanim;
anim_t *lastanim = NULL;
anim_t *anims = NULL; /// \todo free leak
static size_t maxanims;
+3 -3
View File
@@ -44,7 +44,7 @@
// Dynamic slopes
#include "p_slopes.h"
tic_t leveltime;
tic_t leveltime = 0;
//
// THINKERS
@@ -55,8 +55,8 @@ tic_t leveltime;
//
// Both the head and tail of the thinker list.
thinker_t thinkercap;
thinker_t precipcap;
thinker_t thinkercap = {};
thinker_t precipcap = {};
void Command_Numthinkers_f(void)
{
+20 -11
View File
@@ -26,11 +26,11 @@
#include "qs22j.h"
seg_t *curline;
side_t *sidedef;
line_t *linedef;
sector_t *frontsector;
sector_t *backsector;
seg_t *curline = NULL;
side_t *sidedef = NULL;
line_t *linedef = NULL;
sector_t *frontsector = NULL;
sector_t *backsector = NULL;
// very ugly realloc() of drawsegs at run-time, I upped it to 512
// instead of 256.. and someone managed to send me a level with
@@ -40,29 +40,38 @@ drawseg_t *drawsegs = NULL;
drawseg_t *ds_p = NULL;
// indicates doors closed wrt automap bugfix:
INT32 doorclosed;
INT32 doorclosed = 0;
// A wall was drawn covering the whole screen, which means we
// can block off the BSP across that seg.
boolean g_walloffscreen;
boolean g_walloffscreen = false;
boolean R_NoEncore(sector_t *sector, boolean ceiling)
{
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 12 || GETSECSPECIAL(sector->special, 2) == 15); // keeping this incase its used
const INT32 invspecial = GETSECSPECIAL(sector->special, 2);
boolean invertencore = (invspecial == 12 || invspecial == 15); // keeping this incase its used
#if 0 // perfect implementation
INT32 val = GETSECSPECIAL(sector->special, 3);
if (val != 1 && val != 3 // spring panel
const INT32 sprnspecial = GETSECSPECIAL(sector->special, 3);
if (sprnspecial != 1 && sprnspecial != 3 // spring panel
#else // optimised, see #define GETSECSPECIAL(i,j) ((i >> ((j-1)*4))&15)
if ((!(sector->special & (1<<8)) || (sector->special & ((4|8)<<8))) // spring panel
#endif
&& GETSECSPECIAL(sector->special, 4) != 6) // sneaker panel
return invertencore;
{
return invertencore;
}
if (invertencore)
{
return false;
}
if (ceiling)
{
return ((boolean)(sector->flags & SF_FLIPSPECIAL_CEILING));
}
return ((boolean)(sector->flags & SF_FLIPSPECIAL_FLOOR));
}
+2 -2
View File
@@ -83,7 +83,7 @@ typedef struct
// a patch or sprite is composed of zero or more columns.
//
size_t numspritelumps, max_spritelumps;
size_t numspritelumps = 0, max_spritelumps = 0;
// textures
INT32 numtextures = 0; // total number of textures found,
@@ -110,7 +110,7 @@ UINT8 invertmap[256];
#endif
// for debugging/info purposes
size_t flatmemory, spritememory, texturememory; // gotta play by 2.2 rules to get this to work
static size_t flatmemory = 0, spritememory = 0, texturememory = 0; // gotta play by 2.2 rules to get this to work
// Blends two pixels together, using the equation
// that matches the specified alpha style.
-2
View File
@@ -91,8 +91,6 @@ UINT8 *R_GetFlat(lumpnum_t flatnum);
void R_InitData(void);
void R_PrecacheLevel(void);
extern size_t flatmemory, spritememory, texturememory;
// Retrieval.
// Floor/ceiling opaque texture tiles,
// lookup by name. For animation?
+8 -4
View File
@@ -114,6 +114,11 @@ typedef struct
fixed_t x, y, z;
} vertex_t;
typedef struct
{
float x, y/*, z*/;
} floatvertex_t;
// Forward of linedefs, for sectors.
struct line_s;
@@ -543,12 +548,11 @@ typedef struct seg_s
sector_t *frontsector;
sector_t *backsector;
fixed_t length; // precalculated seg length
fixed_t length; // precalculated seg length
#ifdef HWRENDER
// new pointers so that AdjustSegs doesn't mess with v1/v2
polyvertex_t *pv1;
polyvertex_t *pv2;
floatvertex_t fv1;
floatvertex_t fv2;
#endif
polyobj_t *polyseg;
+15 -15
View File
@@ -41,40 +41,40 @@
/** \brief view info
*/
INT32 viewwidth, viewheight, viewwindowx, viewwindowy;
INT32 viewwidth = 0, viewheight = 0, viewwindowx = 0, viewwindowy = 0;
// =========================================================================
// COLUMN DRAWING CODE STUFF
// =========================================================================
drawcolumndata_t g_dc;
drawcolumndata_t g_dc = {};
// -----------------------
// translucency stuff here
// -----------------------
#define NUMTRANSTABLES 9 // how many translucency tables are used
UINT8 *transtables; // translucency tables
UINT8 *blendtables[NUMBLENDMAPS];
UINT8 *transtables = NULL; // translucency tables
UINT8 *blendtables[NUMBLENDMAPS] = {};
// --------------------------------------------
// c drawer routines
// --------------------------------------------
coldrawfunc_t *colfunc;
coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX];
int colfunctype;
coldrawfunc_t *colfunc = NULL;
coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX] = {};
int colfunctype = 0;
// =========================================================================
// SPAN DRAWING CODE STUFF
// =========================================================================
drawspandata_t g_ds;
drawspandata_t g_ds = {};
// Vectors for Software's tilted slope drawers
floatv3_t *ds_su, *ds_sv, *ds_sz;
floatv3_t *ds_su = NULL, *ds_sv = NULL, *ds_sz = NULL;
float focallengthf;
float focallengthf = 0.0f;
// For, uh, tilted lighting, duh.
//static INT32 *tiltlighting;
@@ -83,8 +83,8 @@ float focallengthf;
// c drawer routines
// --------------------------------------------
spandrawfunc_t *spanfunc;
spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
spandrawfunc_t *spanfunc = NULL;
spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX] = {};
// ==========================================================================
// OLD DOOM FUZZY EFFECT
@@ -105,10 +105,10 @@ spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
#define DEFAULT_STARTTRANSCOLOR 160
#define NUM_PALETTE_ENTRIES 256
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {NULL};
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL};
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {};
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {};
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1] = {};
struct GenerateBlendTables_State
{
+25 -25
View File
@@ -49,54 +49,54 @@
// increment every time a check is made
size_t validcount = 1;
INT32 centerx, centery;
INT32 centerx = 0, centery = 0;
fixed_t centerxfrac, centeryfrac;
fixed_t projection;
fixed_t projectiony; // aspect ratio
fixed_t fovtan; // field of view
fixed_t centerxfrac = 0, centeryfrac = 0;
fixed_t projection = 0;
fixed_t projectiony = 0; // aspect ratio
fixed_t fovtan = 0; // field of view
// just for profiling purposes
size_t framecount;
size_t framecount = 0;
size_t loopcount;
size_t loopcount = 0;
fixed_t viewx, viewy, viewz;
angle_t viewangle, aimingangle, viewroll;
fixed_t viewx = 0, viewy = 0, viewz = 0;
angle_t viewangle = 0, aimingangle = 0, viewroll = 0;
UINT8 viewssnum = 0;
fixed_t viewcos, viewsin;
boolean skyVisible;
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
sector_t *viewsector;
player_t *viewplayer;
fixed_t viewcos = 0, viewsin = 0;
boolean skyVisible = 0;
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS] = {}; // saved values of skyVisible for each splitscreen player
sector_t *viewsector = NULL;
player_t *viewplayer = NULL;
fixed_t renderdeltatics;
boolean renderisnewtic;
fixed_t renderdeltatics = 0;
boolean renderisnewtic = true;
//
// precalculated math tables
//
angle_t clipangle;
angle_t doubleclipangle;
angle_t clipangle = 0;
angle_t doubleclipangle = 0;
// The viewangletox[viewangle + FINEANGLES/4] lookup
// maps the visible view angles to screen X coordinates,
// flattening the arc to a flat projection plane.
// There will be many angles mapped to the same X.
INT32 viewangletox[FINEANGLES/2];
INT32 viewangletox[FINEANGLES/2] = {};
// The xtoviewangleangle[] table maps a screen pixel
// to the lowest viewangle that maps back to x ranges
// from clipangle to -clipangle.
angle_t *xtoviewangle = NULL;
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE] = {};
lighttable_t *scalelightfixed[MAXLIGHTSCALE] = {};
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ] = {};
// Hack to support extra boom colormaps.
size_t num_extra_colormaps;
extracolormap_t extra_colormaps[MAXCOLORMAPS];
size_t num_extra_colormaps = 0;
extracolormap_t extra_colormaps[MAXCOLORMAPS] = {};
// Performance stats
precise_t ps_prevframetime = 0;
@@ -187,7 +187,7 @@ consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL,
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ffloorclip = {"r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_spriteclip = {"r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_softcyancut = {"softwarecyancut", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_softcyancut = {"softwarecyancut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NOINIT, drawdist_precip_cons_t, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
+2 -2
View File
@@ -23,8 +23,8 @@
//
// Angles precalculated in R_InitSprites.
//
fixed_t rollcosang[ROTANGLES];
fixed_t rollsinang[ROTANGLES];
fixed_t rollcosang[ROTANGLES] = {};
fixed_t rollsinang[ROTANGLES] = {};
INT32 R_GetRollAngle(angle_t rollangle)
{
+6 -6
View File
@@ -21,16 +21,16 @@
#include "r_things.h"
#include "r_sky.h"
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
UINT8 portalrender = 0; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
// Linked list for portals.
portal_t *portal_base, *portal_cap;
portal_t *portal_base = NULL, *portal_cap = NULL;
line_t *portalclipline;
sector_t *portalcullsector;
INT32 portalclipstart, portalclipend;
line_t *portalclipline = NULL;
sector_t *portalcullsector = NULL;
INT32 portalclipstart = 0, portalclipend = 0;
portal_t *g_portal; // is curline a portal seg?
portal_t *g_portal = NULL; // is curline a portal seg?
void Portal_InitList (void)
{
+3 -3
View File
@@ -47,10 +47,10 @@ static INT32 toptexture, bottomtexture, midtexture;
static bool topremap, bottomremap, midremap;
static INT32 numthicksides, numbackffloors;
angle_t rw_normalangle;
angle_t rw_normalangle = 0;
// angle to line origin
angle_t rw_angle1;
fixed_t rw_distance;
angle_t rw_angle1 = 0;
fixed_t rw_distance = 0;
//
// regular wall
+6 -6
View File
@@ -33,7 +33,7 @@
#include "qs22j.h"
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; // huehuehuehuehue
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2] = {}; // huehuehuehuehue
#include "discord.h"
@@ -55,15 +55,15 @@ UINT8 skinstatscount[9][9] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0}
};
UINT8 skinsorted[MAXSKINS];
skin_t localskins[MAXLOCALSKINS];
skin_t allskins[MAXSKINS+MAXLOCALSKINS];
UINT8 skinsorted[MAXSKINS] = {};
skin_t localskins[MAXLOCALSKINS] = {};
skin_t allskins[MAXSKINS+MAXLOCALSKINS] = {};
// FIXTHIS: don't work because it must be inistilised before the config load
//#define SKINVALUES
#ifdef SKINVALUES
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1];
CV_PossibleValue_t skin_cons_t[MAXSKINS+1] = {};
CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1] = {};
#endif
static void Sk_SetDefaultValue(skin_t *skin, boolean local)
+7 -9
View File
@@ -22,8 +22,6 @@
#include "w_wad.h"
#include "z_zone.h"
#include "p_maputl.h" // P_PointOnLineSide
//
// sky mapping
//
@@ -31,28 +29,28 @@
/** \brief Needed to store the number of the dummy sky flat.
Used for rendering, as well as tracking projectiles etc.
*/
INT32 skyflatnum;
INT32 skyflatnum = 0;
/** \brief the lump number of the sky texture
*/
INT32 skytexture;
INT32 skytexture = 0;
/** \brief the horizon line in a 256x128 sky texture
*/
INT32 skytexturemid;
INT32 skytexturemid = 0;
/** \brief the x offset of the sky texture
*/
INT32 skytextureoffset;
INT32 skytextureoffset = 0;
/** \brief the scale of the sky
*/
fixed_t skyscale;
fixed_t skyscale = 0;
/** \brief used for keeping track of the current sky
*/
INT32 levelskynum;
INT32 globallevelskynum;
INT32 levelskynum = 0;
INT32 globallevelskynum = 0;
/** \brief The R_SetupSkyDraw function
+4 -4
View File
@@ -95,15 +95,15 @@ static INT32 drawsegs_xrange_count = 0;
// There was a lot of stuff grabbed wrong, so I changed it...
//
spriteinfo_t spriteinfo[NUMSPRITES];
spriteinfo_t spriteinfo[NUMSPRITES] = {};
//
// INITIALIZATION FUNCTIONS
//
// variables used to look up and range check thing_t sprites patches
spritedef_t *sprites;
size_t numsprites;
spritedef_t *sprites = NULL;
size_t numsprites = 0;
static spriteframe_t sprtemp[64];
static size_t maxframe;
@@ -112,7 +112,7 @@ static const char *spritename;
//
// GAME FUNCTIONS
//
UINT32 visspritecount, numvisiblesprites;
UINT32 visspritecount = 0, numvisiblesprites = 0;
static UINT32 clippedvissprites;
static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL};
+1 -1
View File
@@ -1832,7 +1832,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
}
}
void S_ChangeMusicSpecial (const char *mmusic)
void S_ChangeMusicSpecial(const char *mmusic)
{
if (cv_resetspecialmusic.value)
S_ChangeMusic(mmusic, MUSIC_FORCERESET, true);
+2 -2
View File
@@ -36,8 +36,8 @@
// ------------------
// global video state
// ------------------
viddef_t vid;
INT32 setmodeneeded; // video mode change needed if > 0 (the mode number to set + 1)
viddef_t vid = {};
INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to set + 1)
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
+32 -63
View File
@@ -719,16 +719,13 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{
SDL_GameControllerClose(JoySet->dev);
}
JoySet->dev = NULL;
JoySet->oldjoy = -1;
JoySet->id = -1;
JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0;
//JoySet->scale
}
/** \brief joystick up and running
*/
static INT32 joystick_started[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
/** \brief SDL info about joystick
*/
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
@@ -783,22 +780,26 @@ void I_UpdateJoystickDeviceIndex(UINT8 player)
///////////////////////////////////////////////
if (JoyInfo[player].dev)
{
cv_usejoystick[player].value = I_GetJoystickDeviceIndex(JoyInfo[player].dev) + 1;
cv_usejoystick[player].value = JoyInfo[player].id + 1;
}
else
{
UINT8 joystickID, compareJoystick;
for (joystickID = 0; joystickID < MAXSPLITSCREENPLAYERS; joystickID++)
{
// is this cv_usejoystick used?
const INT32 value = atoi(cv_usejoystick[joystickID].string);
for (compareJoystick = 0; compareJoystick < MAXSPLITSCREENPLAYERS; compareJoystick++)
{
if (compareJoystick == player)
continue;
if (value == JoyInfo[compareJoystick].oldjoy || value == cv_usejoystick[compareJoystick].value)
break;
}
if (compareJoystick == MAXSPLITSCREENPLAYERS)
{
// We DID make it through the whole loop, so we can use this one!
@@ -806,6 +807,7 @@ void I_UpdateJoystickDeviceIndex(UINT8 player)
break;
}
}
if (joystickID == MAXSPLITSCREENPLAYERS)
{
// We DID NOT make it through the whole loop, so we can't assign this joystick to anything.
@@ -828,14 +830,6 @@ void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer)
}
}
/** \brief Joystick buttons states
*/
static UINT64 lastjoybuttons[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
/** \brief Joystick hats state
*/
static UINT64 lastjoyhats[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
/** \brief Shuts down joystick
\return void
*/
@@ -847,74 +841,34 @@ void I_ShutdownJoystick(UINT8 index)
event.data2 = 0;
event.data3 = 0;
lastjoybuttons[index] = lastjoyhats[index] = 0;
// emulate the up of all joystick buttons
for (i = 0; i < JOYBUTTONS; i++)
{
event.data1=KEY_JOY1 + i;
event.data1 = KEY_JOY1 + i;
D_PostEvent(&event);
}
// emulate the up of all joystick hats
for (i = 0; i < JOYHATS*4; i++)
{
event.data1=KEY_HAT1+i;
event.data1 = KEY_HAT1+i;
D_PostEvent(&event);
}
// reset joystick position
event.type = ev_joystick;
for (i = 0; i < JOYAXISSET; i++)
{
event.data1 = i;
D_PostEvent(&event);
}
joystick_started[index] = 0;
JoyReset(&JoyInfo[index]);
// don't shut down the subsystem here, because hotplugging
}
void I_GetJoystickEvents(UINT8 index)
{
static event_t event = {};
INT32 i = 0;
UINT64 joyhats = 0;
if (!joystick_started[index])
return;
if (!JoyInfo[index].dev) //I_ShutdownJoystick();
return;
joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_UP);
joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_DOWN) << 1;
joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_LEFT) << 2;
joyhats |= SDL_GameControllerGetButton(JoyInfo[index].dev, SDL_CONTROLLER_BUTTON_DPAD_RIGHT) << 3;
if (joyhats != lastjoyhats[index])
{
INT64 j = 1; // keep only bits that changed since last time
INT64 newhats = joyhats ^ lastjoyhats[index];
lastjoyhats[index] = joyhats;
for (i = 0; i < JOYHATS*4; i++, j <<= 1)
{
if (newhats & j) // hat changed state?
{
if (joyhats & j)
event.type = ev_keydown;
else
event.type = ev_keyup;
event.data1 = KEY_HAT1 + i;
D_PostEvent(&event);
}
}
}
}
/** \brief Open joystick handle
\param fname name of joystick
@@ -931,6 +885,7 @@ static int joy_open(int playerIndex, int joyIndex)
CONS_Printf(M_GetText("Joystick subsystem not started\n"));
return -1;
}
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
{
CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
@@ -965,12 +920,14 @@ static int joy_open(int playerIndex, int joyIndex)
if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do
|| (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_CONTROLLER_AXIS_MAX;
// Else, we're changing devices, so send neutral joy events
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
I_ShutdownJoystick(playerIndex);
}
JoyInfo[playerIndex].dev = newdev;
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
if (JoyInfo[playerIndex].dev == NULL)
{
@@ -1007,8 +964,9 @@ void I_InitJoystick(UINT8 index)
UINT8 i;
SDL_GameController *newcontroller = NULL;
//I_ShutdownJoystick();
//SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
// not sure if this is the best place to put this
SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0");
if (M_CheckParm("-nojoy"))
return;
@@ -1037,6 +995,11 @@ void I_InitJoystick(UINT8 index)
}
}
JoyInfo[index].dev = NULL;
JoyInfo[index].oldjoy = -1;
JoyInfo[index].id = -1;
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
@@ -1049,23 +1012,24 @@ void I_InitJoystick(UINT8 index)
break;
}
JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device
{
cv_usejoystick[index].value = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
cv_usejoystick[index].value = JoyInfo[index].id + 1;
}
else if (newcontroller && joy_open(index, cv_usejoystick[index].value) != -1)
{
// SDL's device indexes are unstable, so cv_usejoystick may not match
// the actual device index. So let's cheat a bit and find the device's current index.
JoyInfo[index].oldjoy = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
joystick_started[index] = 1;
JoyInfo[index].oldjoy = JoyInfo[index].id + 1;
}
else
{
if (JoyInfo[index].oldjoy)
I_ShutdownJoystick(index);
cv_usejoystick[index].value = 0;
joystick_started[index] = 0;
}
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -1130,8 +1094,10 @@ static void I_ShutdownInput(void)
INT32 I_NumJoys(void)
{
INT32 numjoy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
numjoy = SDL_NumJoysticks();
return numjoy;
}
@@ -1142,15 +1108,18 @@ const char *I_GetJoyName(INT32 joyindex)
const char *tempname = NULL;
joyname[0] = 0;
joyindex--; //SDL's Joystick System starts at 0, not 1
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{
tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname)
{
memcpy(joyname, tempname, 255);
joyname[255] = '\0';
}
}
return joyname;
}
+156 -72
View File
@@ -523,6 +523,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
#ifdef USE_FBO_OGL
I_DownSample();
#endif
windowmoved = SDL_FALSE;
}
if (mousefocus && kbfocus)
@@ -557,7 +558,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
{
event_t event;
event_t event = {0};
switch (type)
{
@@ -585,7 +586,9 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
}
if (event.data1)
{
D_PostEvent(&event);
}
}
static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
@@ -637,7 +640,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
{
event_t event;
event_t event = {0};
// Ignore the event if the mouse is not actually focused on the window.
// This can happen if you used the mouse to restore keyboard focus;
@@ -650,8 +653,6 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
/// \todo inputEvent.button.which
if (USE_MOUSEINPUT)
{
SDL_memset(&event, 0, sizeof(event_t));
switch (type)
{
case SDL_MOUSEBUTTONUP:
@@ -692,27 +693,28 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
{
event_t event;
event_t event = {0};
if (USE_MOUSEINPUT)
{
SDL_memset(&event, 0, sizeof(event_t));
if (evt.y > 0)
{
event.data1 = KEY_MOUSEWHEELUP;
event.type = ev_keydown;
}
if (evt.y < 0)
{
event.data1 = KEY_MOUSEWHEELDOWN;
event.type = ev_keydown;
}
if (evt.y == 0)
{
event.data1 = 0;
event.type = ev_keyup;
}
if (event.type == ev_keyup || event.type == ev_keydown)
{
D_PostEvent(&event);
@@ -720,40 +722,78 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
}
}
static UINT8 hatrepeattimer[MAXSPLITSCREENPLAYERS];
#define HATREPEATDELAY 19
void I_HandleControllerHatRepeat(void)
{
// why bother if theres no controllers?
if (numcontrollers == 0)
return;
event_t event = {ev_keydown, 0, 0, 0};
static const SDL_GameControllerButton hatbutt[4] =
{
SDL_CONTROLLER_BUTTON_DPAD_UP,
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
};
for (int i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (!cv_usejoystick[i].value)
continue;
SDL_GameController *controller = JoyInfo[i].dev;
if (!controller)
continue;
for (UINT8 h = 0; h < JOYHATS; h++)
{
if (SDL_GameControllerGetButton(controller, hatbutt[h]))
{
if (hatrepeattimer[i] < HATREPEATDELAY)
{
hatrepeattimer[i]++;
}
else if (hatrepeattimer[i] == HATREPEATDELAY)
{
event.data1 = KEY_HAT1 + (i * JOYHATS) + h;
D_PostEvent(&event);
}
return;
}
}
hatrepeattimer[i] = 0;
}
}
static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
{
event_t event;
SDL_JoystickID joyid[4];
INT32 value;
UINT8 i;
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
if (evt.which == JoyInfo[i].id)
{
event.type = ev_joystick + i;
break;
}
}
if (i == MAXSPLITSCREENPLAYERS)
return;
event.data1 = event.data2 = event.data3 = INT32_MAX;
if (evt.which == joyid[0])
{
event.type = ev_joystick;
}
else if (evt.which == joyid[1])
{
event.type = ev_joystick2;
}
else if (evt.which == joyid[2])
{
event.type = ev_joystick3;
}
else if (evt.which == joyid[3])
{
event.type = ev_joystick4;
}
else
return;
//axis
if (evt.axis > JOYAXISSET*2)
return;
@@ -789,47 +829,89 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
default:
return;
}
D_PostEvent(&event);
}
static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type)
static void Impl_HandleControllerHatEvent(SDL_ControllerButtonEvent evt, Uint32 type)
{
event_t event;
SDL_JoystickID joyid[4];
event_t event = {0};
UINT8 i;
static const int hat_buttons_base[] = {KEY_HAT1, KEY_2HAT1, KEY_3HAT1, KEY_4HAT1};
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
if (evt.which == JoyInfo[i].id)
{
event.data1 = hat_buttons_base[i];
break;
}
}
if ( evt.button == SDL_CONTROLLER_BUTTON_DPAD_UP
|| evt.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN
|| evt.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
|| evt.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
if (i == MAXSPLITSCREENPLAYERS)
return;
switch (type)
{
// dpad buttons are mapped as the hat instead
case SDL_CONTROLLERBUTTONUP:
event.type = ev_keyup;
break;
case SDL_CONTROLLERBUTTONDOWN:
event.type = ev_keydown;
break;
default:
return;
}
switch (evt.button)
{
case SDL_CONTROLLER_BUTTON_DPAD_UP:
break;
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
event.data1 += 1;
break;
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
event.data1 += 2;
break;
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
event.data1 += 3;
break;
default:
return;
}
if (event.type != ev_console)
{
D_PostEvent(&event);
}
}
static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type)
{
event_t event = {0};
UINT8 i;
static const int buttons_base[] = {KEY_JOY1, KEY_2JOY1, KEY_3JOY1, KEY_4JOY1};
// dpad special case handling
if (evt.button >= SDL_CONTROLLER_BUTTON_DPAD_UP &&
evt.button <= SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
{
Impl_HandleControllerHatEvent(evt, type);
return;
}
if (evt.which == joyid[0])
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
event.data1 = KEY_JOY1;
if (evt.which == JoyInfo[i].id)
{
event.data1 = buttons_base[i];
break;
}
}
else if (evt.which == joyid[1])
{
event.data1 = KEY_2JOY1;
}
else if (evt.which == joyid[2])
{
event.data1 = KEY_3JOY1;
}
else if (evt.which == joyid[3])
{
event.data1 = KEY_4JOY1;
}
else
if (i == MAXSPLITSCREENPLAYERS)
return;
switch (type)
@@ -852,7 +934,9 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
return;
if (event.type != ev_console)
{
D_PostEvent(&event);
}
}
static void Impl_HandleControllerAddedEvent(SDL_Event evt)
@@ -1096,7 +1180,6 @@ void I_StartupMouse(void)
void I_OsPolling(void)
{
SDL_Keymod mod;
INT32 i;
if (consolevent)
I_GetConsoleEvents();
@@ -1104,9 +1187,6 @@ void I_OsPolling(void)
if (SDL_WasInit(SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER))
{
SDL_GameControllerUpdate();
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
I_GetJoystickEvents(i);
}
I_GetEvent();
@@ -1329,14 +1409,12 @@ void I_UpdateNoBlit(void)
if (rendermode == render_opengl)
{
OglSdlFinishUpdate(cv_vidwait.value);
return;
}
else
#endif
if (rendermode == render_soft)
{
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
}
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
}
exposevideo = SDL_FALSE;
@@ -1371,7 +1449,15 @@ void I_FinishUpdate(void)
ST_AskToJoinEnvelope();
#endif
if (rendermode == render_soft && vid.screens[0])
#ifdef HWRENDER
if (rendermode == render_opengl)
{
OglSdlFinishUpdate(cv_vidwait.value);
return;
}
#endif
if (vid.screens[0])
{
void *pixels;
int pitch;
@@ -1393,12 +1479,6 @@ void I_FinishUpdate(void)
SDL_RenderCopy(renderer, texture, &src_rect, NULL);
SDL_RenderPresent(renderer);
}
#ifdef HWRENDER
else if (rendermode == render_opengl)
{
OglSdlFinishUpdate(cv_vidwait.value);
}
#endif
exposevideo = SDL_FALSE;
}
@@ -1421,7 +1501,8 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
{
if (rendermode != render_soft)
I_Error("I_ReadScreen: called while in non-software mode");
else if (scale == 1)
if (scale == 1)
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.width, vid.width);
else
{
@@ -1596,8 +1677,9 @@ static SDL_bool Impl_CreateContext(void)
}
SDL_GL_MakeCurrent(window, sdlglcontext);
return SDL_TRUE;
}
else
#endif
if (rendermode == render_soft)
{
@@ -1637,9 +1719,11 @@ static SDL_bool Impl_CreateContext(void)
}
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
return SDL_TRUE;
}
return SDL_TRUE;
return SDL_FALSE;
}
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
+1 -1
View File
@@ -73,7 +73,7 @@ write netcode into the sound code, OKAY?
//static UINT16 BUFFERSIZE = 2048;
static UINT16 SAMPLERATE = 44100;
static const UINT16 SAMPLERATE = 44100;
#ifdef HAVE_OPENMPT
#include "libopenmpt/libopenmpt.h"
+2
View File
@@ -42,6 +42,8 @@ typedef struct SDLJoyInfo_s
{
/// Controller handle
SDL_GameController *dev;
/// Controller index
INT32 id;
/// number of old joystick
int oldjoy;
/// number of axies
+1 -1
View File
@@ -100,7 +100,7 @@ Please check it out if you're trying to maintain this.
toast 18/04/17
*/
float Cubepal[2][2][2][3];
float Cubepal[2][2][2][3] = {};
boolean Cubeapply = false;
// returns whether to apply cube, selectively avoiding expensive operations