Compare commits

...
60 Commits
Author SHA1 Message Date
Alug 8cf2395d42 Merge branch 'Saturn-Next' into Saturn 2025-12-06 15:45:51 +01:00
Alug f578781418 put "string.c" earliest in sourcefile
otherwise Windows is unable to find nongnu_strcasestr
2025-12-06 15:45:45 +01:00
indev 0bb63ee0af Use size_t there 2025-12-06 17:34:05 +03:00
Alug 3abe74de86 release 9.2 2025-12-06 15:33:41 +01:00
Alug 5a61ebf325 Merge branch 'Saturn-Next' into Saturn 2025-12-06 15:33:08 +01:00
Alug 2ae9563ab3 Menu: fix camera options from within accessability options returning to the main menu
really wonky setup, but some other menus do similar things...
2025-12-05 19:13:01 +01:00
indev 6b429e4388 Add locatelump command 2025-12-05 20:35:48 +03:00
Alug 0321b0d94a m_menu: do some cleanup - replay drawers 2025-12-05 17:29:49 +01:00
Alug ac57b7fd2d Menu: show stats for current skin in Time Attack menu
+ some cleanup
2025-12-05 17:29:46 +01:00
Alug 7013e63142 Menus: dont advertise encore toggle if its not unlocked yet!
this wont do anything anyways besides telling you you havent unlocked it yet
so can just hide it
2025-12-05 17:29:43 +01:00
Alug 4e1ef7c0cd Revert "remove the wonky double tap input for controllers"
This reverts commit 9e2fd091a8.

causes some wonky issues still, will need to look into it more, but for now revert
2025-12-05 15:11:51 +01:00
Alug 892f2253ea p_spec: remove hardcoded animdefs table
srb2.srb includes an ANIMDEFS file which WILL override this anyways and includes any of these.
so no need to complicate the code with this
2025-12-05 14:58:19 +01:00
Alug bebe62346f fix Flat loading code passing non null terminated strings to W_CheckNumForName 2025-12-05 14:58:15 +01:00
indev 834a94e429 Ok i guess we still need old_z2 :ChonkBunckle: 2025-12-05 03:10:41 +03:00
indev fcf833ff48 Move ghost mobj old_x2 hack into P_SpawnGhostMobj to cover all cases where it would matter
ty lug <3
2025-12-05 03:10:41 +03:00
indev f2a27539d3 Experimental: remove mobj->old_x2, old_y2, etc fields 2025-12-05 03:10:41 +03:00
Alug 05d26654df p_user: do some tiny cleanups 2025-12-05 01:07:18 +01:00
Alug cee6a27340 mark debugfile with UNLIKELY
this is for debug, and esp network debug which barely anyone ever needs, so can tell compiler better branch hint
2025-12-05 01:07:14 +01:00
Alug 66e35a9d67 k_kart: slightly cleanup driftrelease code 2025-12-05 00:29:31 +01:00
indev ad096ccd42 Update LUASTUFF.md 2025-12-04 19:21:30 +03:00
Alug 7a9e81828a forgot to remove this oops 2025-12-04 15:41:20 +01:00
Alug 71e7dacb56 r_opengl: dont set directional light model shader uniforms if we dont use them 2025-12-04 01:26:43 +01:00
Alug f9c0ee865f make those ternaries a little prettier lul 2025-12-04 01:23:42 +01:00
Alug 154eaaf027 hw_main: cleanup and simplify HWR_RenderPolyObjectPlane 2025-12-04 01:23:39 +01:00
Alug 66f5f9b2a2 hw_main: handle implicit float conversion cases explicitly 2025-12-04 01:23:36 +01:00
Alug b27275b887 hw_batching: fix typo in non shader polygon comparitor
checked poly1 against poly1 sky
2025-12-03 18:15:30 +01:00
indev c81c2c1d8d Add option to show current song credits in pause menu 2025-12-03 15:47:38 +03:00
indev ccfab57a8c Add 'time per frame' argument for hud.setVoteBackground 2025-12-02 23:59:02 +03:00
Alug 56d1343f1b dont call CON_Drawer during frameskip, just call CON_MoveConsole instead
fixes the issue at hand, without making the console flicker in gifs
sigh....
2025-12-02 20:49:56 +01:00
indev b273bc3ca8 Hide localskins menus immediately when option is changed
@Alug :blobhug:
2025-12-02 22:12:49 +03:00
Alug d4f58a885b add toggle to let console prints show in main menus
if you want this for some reason
2025-12-02 20:07:56 +01:00
Alug 04458f18f8 m_menu: fix splitscreen players being unable to change the names from player setup
smol oversight :blobcatpats:
2025-12-02 19:43:05 +01:00
indev 64152eea0d Fix few possible multithreading bugs related to ReplayNamesLoadThread 2025-12-02 20:59:27 +03:00
indev 0e0a690e3c Print a warning when luaL_resourcetryagain force triggers garbage collector 2025-12-02 20:39:38 +03:00
Alug f283d3ca43 suppress wrong "-Warray-bounds" warning in G_DeviceLEDTick
newer gcc does this for whatever reason, its fine
splitscreen will never call this out of its bounds
2025-12-02 18:40:30 +01:00
Alug 982fff959f blua: attempt emergency garbo collection on file io operations if they fail
ports of
https://github.com/lua/lua/commit/e885dee5ab4dbee2457ee2023340e848fdabdef9

and

https://github.com/lua/lua/commit/3d838f635cc81ec3332f9a904992db1c6d8a46ad

prevents massive memory leaks and other issues due to faulty lua scripts
2025-12-02 18:31:32 +01:00
Alug b0e968e3c3 raise version number to 9.2 2025-12-02 15:54:53 +01:00
Alug e5bbb14ce0 replayhut: fix race condition in M_ResetDemoList freeing the demolist vars
in rare cases this could free the data the thread is currently using
so we gotta wait for it to finish first
2025-12-02 14:59:12 +01:00
Alug 327cca2e8e change freecam condition for awayview
shouldnt change the behavior much as we wont see anything without a camera, but this is explicit about what exactly is wanted (i.e. thiscam may be null, we only check due to null deref, we only care about if freecam is active)
2025-12-02 12:48:47 +01:00
Alug e02e9a12d7 ticcmd: replace magic numbers with constants
names lifted from RR
2025-12-02 12:48:43 +01:00
Alug 9e2fd091a8 remove the wonky double tap input for controllers
finally figured out what occasionally messed up my bound controls lol
why in the world is this even a thing for controllers??
2025-12-02 00:58:18 +01:00
Alug 0a04fca634 remove mlooky, rename mousesens to mousexsens, make mouse y sensitivity not be affected by x sensitivity
mlooky basically just took the place of mousey, which did nothing before, but is a better name
2025-12-02 00:55:59 +01:00
Alug 8a3f793324 g_input: init some globals that were missed 2025-12-02 00:43:27 +01:00
Alug e91892849c dont let splitplayers 3 and 4 input gamecontrols in the menu
oversight lul
2025-12-02 00:43:22 +01:00
Alug 6b4e3c9d13 update saturn credits
phew so every line now has two names
otherwise we cannot fit everything and anyone into this anymore
this even allowed to put back the tooltip at the bottom
i still want to redo the credits completely at some point with some cool stuff though
2025-12-01 23:41:27 +01:00
indev 5f55b81fbf Fix M_ClearMenus being called too early in map command func 2025-12-02 00:51:40 +03:00
Alug ca68bab002 fix more cases of dangerous PU_PATCH_LOWPRIORITY 2025-12-01 22:31:20 +01:00
Alug 339eb1879e fix the credits freeing our HUD item patches
goddamit i hate PU_PATCH_LOWPRIORITY
2025-12-01 22:24:42 +01:00
indev 1adb49c65c Fix emotes being slightly offset in chat log 2025-12-02 00:02:55 +03:00
Alug 1d33a05a85 Fix some Serverbrowser issues
- Fix serverlist results not being properly reset, which lead to reopening/refreshing the serverlist to show the old state, selecting one of those "old" servers then lead to just connecting to nothing
- Fix the resfresh button making servers disappear if hit too often too fast (from srb2)

https://codeberg.org/srb2classic/srb2classic/commit/3acc312923da0fe5e07c0517d9bff9e8b657b1eb
2025-12-01 21:57:57 +01:00
Alug cfcd20d44a G_AdjustViewEx and macro for G_AdjustView
neppy likes it more which is fair so we do this too
2025-12-01 21:08:30 +01:00
Alug 204607e272 replays: always check if map is loaded not just in old 1.0 replays
cause like, otherwise it will just I_Error which is worse lol
like this we just get thrown back to titlescreen
2025-12-01 21:03:57 +01:00
Alug b89a8ca6f9 replays: properly throw player back to titlescreen from replay error
fixes the game becoming stuck in limbo state if replay fails to start
2025-12-01 21:03:57 +01:00
indev d4aa352d59 Don't try to open replay if no replays are found 2025-12-01 22:49:36 +03:00
Alug c489841732 Fix record attack ghosts sometimes crashing
due to ghosts occasionally ending to early and game interpreting them as still valid uhhhhh
lets pray this wont explode or cause any weird issues......

credits to RR

REVERT THIS ONCE I GO AND FIXUP THE REPLAY MESS
2025-12-01 20:19:11 +01:00
Alug a6a97b4c4f add gdb_history to gitignore 2025-12-01 20:19:03 +01:00
indev fba070f82e Expose cameras to lua outside of hud hooks 2025-12-01 21:08:24 +03:00
Alug 10c117f95f dont reset freecam if the player you are "supposed to be watching" specs in replays
this aint pretty, but im too lazy to make it pretty sincerly
2025-12-01 18:23:51 +01:00
Alug bceda5beb4 dont force awayview when in freecam 2025-12-01 18:23:48 +01:00
Alug c50c936b1f remove hwr_shutdown call
honestly this didnt help with the issue i had, game should already release all the memory on quit anyways.
this just makes it take longer to quit
2025-11-30 20:28:46 +01:00
49 changed files with 1101 additions and 963 deletions

No files matched your search

+8 -1
View File
@@ -13,10 +13,12 @@ Mainly for use in visual-only addons like secondcolor.
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
## hud.setVoteBackground(name)
## hud.setVoteBackground(name[, time\_per\_frame])
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
If time\_per\_frame is set, each frame will last this amount of tics, default value is 2
## hud.add(fn, "vote") and hud.add(fn, "intermission")
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
@@ -120,6 +122,11 @@ v.interpLatch(false)
```
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
## cameras[] global array
Local player cameras that can be accessed outside of hud hooks.
`#cameras` will return amount of available cameras. (0 on dedicated server, 1 with 1 player, 4 with 4p splitscreen, etc)
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
Same fields as in SRB2 2.2
+1
View File
@@ -1,3 +1,4 @@
/cscope.out
*.json
*.idx
*.gdb_history
+1 -1
View File
@@ -1,3 +1,4 @@
string.c
am_map.c
b_bot.c
command.c
@@ -42,7 +43,6 @@ s_sound.c
screen.c
sounds.c
st_stuff.c
string.c
tables.c
v_video.c
w_wad.c
+11 -11
View File
@@ -47,7 +47,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
cmd->forwardmove = sonic->player->cmd.forwardmove;
cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE;
if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
@@ -139,13 +139,13 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
// Don't mess with bot inputs during these unhandled movement conditions.
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
if (forward)
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
} else {
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
if (left || right)
@@ -163,23 +163,23 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
right = true;
}
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (right || straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
}
} else {
if (forward)
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (left)
cmd->angleturn += 1280;
if (right)
cmd->angleturn -= 1280;
if (strafeleft)
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
if (straferight)
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
}
if (jump)
cmd->buttons |= BT_DRIFT;
+51
View File
@@ -93,6 +93,57 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
/* }====================================================== */
/*
** {======================================================
** 'luaL_resourcetryagain'
** This function uses 'errno' to check whether the last error was
** related to lack of resources (e.g., not enough memory or too many
** open files). If so, the function performs a full garbage collection
** to try to release resources, and then it returns 1 to signal to
** the caller that it is worth trying again the failed operation.
** Otherwise, it returns 0. Because error codes are not ANSI C, the
** code must handle any combination of error codes that are defined.
** =======================================================
*/
LUALIB_API int luaL_resourcetryagain (lua_State *L) {
/* these are the resource-related errors in Linux */
#if defined(EMFILE) || defined(ENFILE) || defined(ENOMEM)
#if !defined(EMFILE) /* too many open files in the process */
#define EMFILE -1 /* if not defined, use an impossible value */
#endif
#if !defined(ENFILE) /* too many open files in the system */
#define ENFILE -1
#endif
#if !defined(ENOMEM) /* not enough memory */
#define ENOMEM -1
#endif
if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
CONS_Alert(CONS_WARNING, "%s, force calling lua garbage collector\n", strerror(errno));
lua_gc(L, LUA_GCCOLLECT, 0); /* try to release resources with a full GC */
return 1; /* signal to try again the creation */
}
#endif
return 0; /* else, asume errors are not due to lack of resources */
}
/* }====================================================== */
/*
** {======================================================
** Userdata's metatable manipulation
** =======================================================
*/
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
const char *const lst[]) {
const char *name = (def) ? luaL_optstring(L, narg, def) :
+2
View File
@@ -95,6 +95,8 @@ LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_resourcetryagain) (lua_State *L);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+23 -15
View File
@@ -58,12 +58,6 @@ static int pushresult (lua_State *L, int i, const char *filename) {
}
static void fileerror (lua_State *L, int arg, const char *filename) {
lua_pushfstring(L, "%s: %s", filename, strerror(errno));
luaL_argerror(L, arg, lua_tostring(L, -1));
}
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
@@ -165,6 +159,24 @@ static int StartsWith(const char *a, const char *b) // this is wolfs being lazy
return 0;
}
/*
** Equivalent to 'fopen', but if it fails due to a lack of resources
** (see 'luaL_resourcetryagain'), do an "emergency" garbage collection to try
** to close some files and then tries to open the file again.
*/
static FILE *trytoopen (lua_State *L, const char *path, const char *mode) {
FILE *f = fopen(path, mode);
if (f == NULL && luaL_resourcetryagain(L)) /* resource failure? */
f = fopen(path, mode); /* try to open again */
return f;
}
static void opencheck (lua_State *L, const char *fname, const char *mode) {
FILE **p = newfile(L);
*p = trytoopen(L, fname, mode);
if (l_unlikely(*p == NULL))
luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno));
}
static int io_open(lua_State *L)
{
@@ -212,7 +224,7 @@ static int io_open(lua_State *L)
}
pf = newfile(L);
*pf = fopen(destFilename, mode);
*pf = trytoopen(L, destFilename, mode);
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
}
@@ -220,6 +232,8 @@ static int io_open(lua_State *L)
static int io_tmpfile (lua_State *L) {
FILE **pf = newfile(L);
*pf = tmpfile();
if (*pf == NULL && luaL_resourcetryagain(L)) /* resource failure? */
*pf = tmpfile(); /* try to open again */
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
}
@@ -238,10 +252,7 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
if (!lua_isnoneornil(L, 1)) {
const char *filename = lua_tostring(L, 1);
if (filename) {
FILE **pf = newfile(L);
*pf = fopen(filename, mode);
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
opencheck(L, filename, mode);
}
else {
tofile(L); /* check that it's a valid file handle */
@@ -290,10 +301,7 @@ static int io_lines (lua_State *L) {
}
else {
const char *filename = luaL_checkstring(L, 1);
FILE **pf = newfile(L);
*pf = fopen(filename, "r");
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
opencheck(L, filename, "r");
aux_lines(L, lua_gettop(L), 1);
return 1;
}
+12 -4
View File
@@ -169,6 +169,8 @@ static CV_PossibleValue_t menuhighlight_cons_t[] =
};
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cons_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg);
//
@@ -426,6 +428,7 @@ void CON_Init(void)
CV_RegisterVar(&cons_backpic);
CV_RegisterVar(&cons_backcolor);
CV_RegisterVar(&cons_menuhighlight);
CV_RegisterVar(&cons_consoleprintinmenu);
COM_AddCommand("bind", CONS_Bind_f);
}
else
@@ -586,12 +589,18 @@ static void CON_ChangeHeight(void)
// Handles Console moves in/out of screen (per frame)
//
static void CON_MoveConsole(void)
void CON_MoveConsole(void)
{
static fixed_t fracmovement = 0;
Lock_state();
if (con_curlines == con_destlines)
{
Unlock_state();
return;
}
// instant
if (!cons_speed.value)
{
@@ -1584,13 +1593,12 @@ void CON_Drawer(void)
}
// console movement
if (con_curlines != con_destlines)
CON_MoveConsole();
CON_MoveConsole();
if (con_curlines > 0)
CON_DrawConsole();
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS)
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS || (cons_consoleprintinmenu.value && gamestate == GS_TITLESCREEN))
CON_DrawHudlines();
Unlock_state();
+2
View File
@@ -36,6 +36,7 @@ extern INT32 con_destlines;
extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor, cons_menuhighlight;
extern consvar_t cons_consoleprintinmenu;
extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\
*skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap;
@@ -51,6 +52,7 @@ void CON_ClearHUD(void); // clear heads up messages
void CON_Ticker(void);
void CON_Drawer(void);
void CON_MoveConsole(void);
void CONS_Error(const char *msg); // print out error msg, and wait a key
// force console to move out
+23 -51
View File
@@ -2069,6 +2069,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
length = FIL_ReadFile(tmpsave, &save.buffer);
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
if (!length)
{
I_Error("Can't read savegame sent");
@@ -2152,7 +2153,7 @@ static void CL_ReloadReceivedSavegame(void)
// we dont have P_ForceLocalAngle so were setting it manually here
for (i = 0; i <= splitscreen; i++)
{
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << 16));
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << TICCMD_REDUCE));
}
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -2191,12 +2192,8 @@ static void SendAskInfo(INT32 node)
HSendPacket(node, false, 0, sizeof (askinfo_pak));
}
serverelem_t serverlist[MAXSERVERLIST];
serverelem_t serverlist[MAXSERVERLIST] = {};
UINT32 serverlistcount = 0;
UINT32 serverlistultimatecount = 0;
static boolean resendserverlistnode[MAXNETNODES];
static tic_t serverlistepoch;
static void SL_ClearServerList(INT32 connectedserver)
{
@@ -2209,8 +2206,7 @@ static void SL_ClearServerList(INT32 connectedserver)
serverlist[i].node = 0;
}
serverlistcount = 0;
memset(resendserverlistnode, 0, sizeof resendserverlistnode);
//memset(serverlist, 0, sizeof(serverlist));
}
static UINT32 SL_SearchServer(INT32 node)
@@ -2227,8 +2223,6 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
{
UINT32 i;
resendserverlistnode[node] = false;
// search if not already on it
i = SL_SearchServer(node);
if (i == UINT32_MAX)
@@ -2262,7 +2256,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
void CL_UpdateServerList (void)
void CL_UpdateServerList(void)
{
SL_ClearServerList(0);
@@ -2280,14 +2274,12 @@ void CL_UpdateServerList (void)
SendAskInfo(BROADCASTADDR);
}
void CL_QueryServerList (msg_server_t *server_list)
void CL_QueryServerList(msg_server_t *server_list)
{
INT32 i;
CL_UpdateServerList();
serverlistepoch = I_GetTime();
for (i = 0; server_list[i].header.buffer[0]; i++)
{
// Make sure MS version matches our own, to
@@ -2300,42 +2292,20 @@ void CL_QueryServerList (msg_server_t *server_list)
if (node == -1)
continue; // no more node free, or resolution failure
SendAskInfo(node);
resendserverlistnode[node] = true;
// Leave this node open. It'll be closed if the
// request times out (CL_TimeoutServerList).
}
}
serverlistultimatecount = i;
}
#define SERVERLISTRESENDRATE NEWTICRATE
void CL_TimeoutServerList(void)
{
if (netgame && serverlistultimatecount > serverlistcount)
{
const tic_t timediff = I_GetTime() - serverlistepoch;
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
const boolean timedout = timediff > connectiontimeout;
if (timedout || (timediff > 0 && timetoresend == 0))
{
INT32 node;
for (node = 1; node < MAXNETNODES; ++node)
{
if (resendserverlistnode[node])
{
if (timedout)
Net_CloseConnection(node|FORCECLOSE);
else
SendAskInfo(node);
}
}
if (timedout)
serverlistultimatecount = serverlistcount;
// Force close the connection so that servers can't eat
// up nodes forever if we never get a reply back from them
// (usually when they've not forwarded their ports).
//
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later!
//
// (Note: as a side effect this probably means every
// server in the list will probably be using the same node (e.g. node 1),
// not that it matters which nodes they use when
// the connections are closed afterwards anyway)
// -- Monster Iestyn 12/11/18
Net_CloseConnection(node|FORCECLOSE);
}
}
}
@@ -4525,7 +4495,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
DEBFILE("spawning me\n");
}
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << 16));
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << TICCMD_REDUCE));
D_SendPlayerConfig();
addedtogame = true;
@@ -6472,6 +6442,7 @@ static void SV_SendTics(void)
continue;
DEBFILE(va("Sent %d anyway\n", realfirsttic));
}
realfirsttic = max(realfirsttic, firstticstosend);
// compute the length of the packet and cut it if too large
@@ -6617,7 +6588,8 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
// -- Monster Iestyn 16/01/18
break;
}
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle >> TICCMD_REDUCE) | TICCMD_RECEIVED);
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
break;
-2
View File
@@ -516,7 +516,6 @@ typedef struct
extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount;
extern UINT32 serverlistultimatecount;
extern INT32 mapchangepending;
// Points inside doomcom
@@ -627,7 +626,6 @@ void CL_ClearPlayer(INT32 playernum);
void CL_RemovePlayer(INT32 playernum, INT32 reason);
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(void);
void CL_TimeoutServerList(void);
void CL_AbortConnection(void);
+3 -4
View File
@@ -792,9 +792,9 @@ void D_SRB2Loop(void)
}
else if (!dedicated)
{
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
// always update console movement
// otherwise it will takes literal ages to open
CON_MoveConsole();
}
}
@@ -885,7 +885,6 @@ void D_ClearState(void)
CURLAbortFile();
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i);
+7 -1
View File
@@ -492,6 +492,7 @@ void Net_AckTicker(void)
ackpak[i].acknum = 0;
continue;
}
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
NODETIMEOUT, I_GetTime()));
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
@@ -1224,7 +1225,7 @@ void D_SetDoomcom(void)
if (doomcom)
return;
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
doomcom = Z_Calloc(sizeof(doomcom_t), PU_STATIC, NULL);
doomcom->id = DOOMCOM_ID;
doomcom->numslots = doomcom->numnodes = 1;
}
@@ -1266,6 +1267,7 @@ boolean D_CheckNetGame(void)
ret = true;
if (client && netgame)
netgame = false;
server = true; // WTF? server always true???
// no! The deault mode is server. Client is set elsewhere
// when the client executes connect command.
@@ -1301,6 +1303,7 @@ boolean D_CheckNetGame(void)
if (doomcom->id != DOOMCOM_ID)
I_Error("Doomcom buffer invalid!");
if (doomcom->numnodes > MAXNETNODES)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
@@ -1309,14 +1312,17 @@ boolean D_CheckNetGame(void)
{
char filename[21];
INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1;
while (!debugfile && k < MAXPLAYERS)
{
k++;
sprintf(filename, "debug%d.txt", k);
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
}
if (debugfile)
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
else
+32 -3
View File
@@ -144,6 +144,7 @@ static void Command_Addfile(void);
static void Command_Addskins(void);
static void Command_GLocalSkin(void);
static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void);
static void Command_ListUnusedSprites_f(void);
static void Command_RunSOC(void);
@@ -270,7 +271,7 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
// haha I've beaten you now, ONLINE
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE|CV_CALL, CV_YesNo, ShowLocalskinMenu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -638,6 +639,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("addskins", Command_Addskins);
COM_AddCommand("listwad", Command_ListWADS_f);
COM_AddCommand("locatelump", Command_LocateLump_f);
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
@@ -937,6 +939,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_pausesongcredits);
CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin);
CV_RegisterVar(&cv_showallmaps);
@@ -1003,7 +1006,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_usemouse);
CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mousexsens);
CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible);
@@ -2647,7 +2650,6 @@ static void Command_Map_f(void)
return;
}
M_ClearMenus(true);
last_map_cmd = I_GetTime();
@@ -2830,6 +2832,8 @@ static void Command_Map_f(void)
fromlevelselect = false;
M_ClearMenus(true);
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
}
@@ -4720,6 +4724,31 @@ static void Command_ListWADS_f(void)
}
}
static void Command_LocateLump_f(void)
{
if (COM_Argc() == 1)
{
CONS_Printf("Usage: locatelump <lump1>[ <lump2>[ ...]]\n");
return;
}
for (size_t i = 1; i < COM_Argc(); ++i)
{
const char *name = COM_Argv(i);
lumpnum_t num = W_CheckNumForName(name);
const char *wadname = "(not found)";
if (num != LUMPERROR)
{
wadname = wadfiles[WADFILENUM(num)]->filename;
}
CONS_Printf("%s - %s\n", name, wadname);
}
}
#define MAXDOOMEDNUM 4095
static void Command_ListDoomednums_f(void)
+8 -3
View File
@@ -46,15 +46,20 @@ typedef enum
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
// ticcmd turning bits
#define TICCMD_REDUCE 16
// ticcmd latency mask
#define TICCMD_LATENCYMASK 0xFF
// bits in angleturn
#define TICCMD_RECEIVED 1
#define TICCMD_XY 2
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
typedef struct
{
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50)
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
INT16 angleturn; // << TICCMD_REDUCE for angle delta - saved as 1 byte into demos
INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons;
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
+3 -3
View File
@@ -107,10 +107,10 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9.1"
#define VERSIONSTRINGW L"Saturn v9.1"
#define VERSIONSTRING "Saturn v9.2"
#define VERSIONSTRINGW L"Saturn v9.2"
#define SATURN_TESTING // comment out for saturn release builds!
//#define SATURN_TESTING // comment out for saturn release builds!
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
+1 -1
View File
@@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#else
#define DEBUGFILE
#ifdef DEBUGFILE
#define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } }
#define DEBFILE(msg) { if (UNLIKELY(debugfile)) { fputs(msg, debugfile); fflush(debugfile); } }
#else
#define DEBFILE(msg) {}
#endif
+1 -1
View File
@@ -644,7 +644,7 @@ void F_CreditDrawer(void)
sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics
}
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), colormap);
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), colormap);
}
// Dim the background
+93 -63
View File
@@ -246,10 +246,12 @@ void G_ReadDemoExtraData(void)
{
extradata = READUINT8(demobuf.p);
player_t *player = &players[p];
if (extradata & DXD_RESPAWN)
{
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
}
if (extradata & DXD_SKIN)
@@ -264,11 +266,11 @@ void G_ReadDemoExtraData(void)
kartspeed = READUINT8(demobuf.p);
kartweight = READUINT8(demobuf.p);
if (!fasticmp(skins[players[p].skin].name, name))
if (!fasticmp(skins[player->skin].name, name))
FindClosestSkinForStats(p, kartspeed, kartweight);
players[p].kartspeed = kartspeed;
players[p].kartweight = kartweight;
player->kartspeed = kartspeed;
player->kartweight = kartweight;
}
if (extradata & DXD_COLOR)
@@ -279,9 +281,9 @@ void G_ReadDemoExtraData(void)
for (i = 0; i < MAXSKINCOLORS; i++)
if (fasticmp(KartColor_Names[i], name)) // SRB2kart
{
players[p].skincolor = i;
if (players[p].mo)
players[p].mo->color = i;
player->skincolor = i;
if (player->mo)
player->mo->color = i;
break;
}
}
@@ -300,17 +302,17 @@ void G_ReadDemoExtraData(void)
switch (extradata)
{
case DXD_PST_PLAYING:
players[p].pflags |= PF_WANTSTOJOIN; // fuck you
player->pflags |= PF_WANTSTOJOIN; // fuck you
break;
case DXD_PST_SPECTATING:
players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you
player->pflags &= ~PF_WANTSTOJOIN; // double-fuck you
if (!playeringame[p])
{
CL_ClearPlayer(p);
playeringame[p] = true;
G_AddPlayer(p);
players[p].spectator = true;
player->spectator = true;
// There's likely an off-by-one error in timing recording or playback of joins. This hacks around it so I don't have to find out where that is. \o/
if (oldcmd[p].forwardmove)
@@ -318,11 +320,11 @@ void G_ReadDemoExtraData(void)
}
else
{
players[p].spectator = true;
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL);
player->spectator = true;
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
else
players[p].playerstate = PST_REBORN;
player->playerstate = PST_REBORN;
}
break;
case DXD_PST_LEFT:
@@ -330,7 +332,7 @@ void G_ReadDemoExtraData(void)
break;
}
G_ResetViews();
G_ResetViews(false); // dont reset our freecam pls thx!
// maybe these are necessary?
if (G_BattleGametype())
@@ -1132,7 +1134,29 @@ void G_GhostTicker(void)
for (g = ghosts, p = NULL; g; g = g->next)
{
// Skip normal demo data.
UINT8 ziptic = READUINT8(g->p);
UINT8 ziptic;
if (g->done)
{
continue;
}
ziptic = READUINT8(g->p);
fadeghost:
// Demo ends after ghost data.
if (ziptic == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
g->done = true;
if (p)
{
p->next = g->next;
}
continue;
}
#ifdef DEMO_COMPAT_100
if (g->version != 0x0001)
@@ -1140,8 +1164,14 @@ void G_GhostTicker(void)
#endif
while (ziptic != DW_END) // Get rid of extradata stuff
{
if (ziptic == 0) // Only support player 0 info for now
if (ziptic < MAXPLAYERS)
{
#ifdef DEVELOP
UINT8 playerid = ziptic;
#endif
// We want to skip *any* player extradata because some demos have extradata for bogus players,
// but if there is tic data later for those players *then* we'll consider it invalid.
ziptic = READUINT8(g->p);
if (ziptic & DXD_SKIN)
@@ -1153,13 +1183,26 @@ void G_GhostTicker(void)
if (ziptic & DXD_NAME)
g->p += 16; // yea
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
if (ziptic & DXD_PLAYSTATE)
{
UINT8 playstate = READUINT8(g->p);
if (playstate != DXD_PST_PLAYING)
{
#ifdef DEVELOP
CONS_Alert(CONS_WARNING, "Ghost demo has non-playing playstate for player %d\n", playerid + 1);
#endif
;
}
}
}
else if (ziptic == DW_RNG)
{
g->p += 4; // RNG seed
}
else
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
{
I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this
}
ziptic = READUINT8(g->p);
}
@@ -1182,7 +1225,7 @@ void G_GhostTicker(void)
if (ziptic & ZT_DRIFT)
g->p += 2;
if (ziptic & ZT_LATENCY)
g->p += 1;
g->p++;
// Grab ghost data.
ziptic = READUINT8(g->p);
@@ -1191,10 +1234,12 @@ void G_GhostTicker(void)
if (g->version != 0x0001)
{
#endif
if (ziptic == DEMOMARKER) // Had to end early for some reason
goto fadeghost;
if (ziptic == 0xFF)
goto skippedghosttic; // Didn't write ghost info this frame
else if (ziptic != 0)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
if (ziptic != 0)
I_Error("Ghost is not a record attack ghost ZIPTIC"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100
}
@@ -1365,7 +1410,7 @@ void G_GhostTicker(void)
{
#endif
if (READUINT8(g->p) != 0xFF) // Make sure there isn't other ghost data here.
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
I_Error("Ghost is not a record attack ghost GHOSTEND"); //@TODO lmao don't blow up like this
#ifdef DEMO_COMPAT_100
}
#endif
@@ -1385,20 +1430,6 @@ skippedghosttic:
break;
}
// Demo ends after ghost data.
if (*g->p == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
if (p)
p->next = g->next;
else
ghosts = g->next;
Z_Free(g);
continue;
}
p = g;
}
}
@@ -1593,7 +1624,7 @@ void G_ConfirmRewind(tic_t rewindtime)
displayplayers[2] = olddp3;
displayplayers[3] = olddp4;
R_ExecuteSetViewSize();
G_ResetViews();
G_ResetViews(true);
for (i = splitscreen; i >= 0; i--)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
@@ -2581,7 +2612,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return;
}
@@ -2593,7 +2624,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
return;
}
else // it's an internal demo
@@ -2613,7 +2644,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2639,7 +2670,7 @@ void G_DoPlayDemo(char *defdemoname)
default:
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2650,7 +2681,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2667,7 +2698,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2725,7 +2756,7 @@ void G_DoPlayDemo(char *defdemoname)
CONS_Alert(CONS_ERROR, "%s", msg);
if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out.
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
@@ -2763,6 +2794,16 @@ void G_DoPlayDemo(char *defdemoname)
#endif
demobuf.p += 4; // Extrainfo location
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
#ifdef DEMO_COMPAT_100
if (demo.version == 0x0001)
{
@@ -2790,17 +2831,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2823,7 +2854,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2861,7 +2892,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2910,7 +2941,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -2922,7 +2953,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, NULL, MM_NOTHING);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
@@ -3532,7 +3563,6 @@ void G_FreeGhosts(void)
ghosts = NULL;
}
boolean G_CheckDemoStatus(void)
{
G_FreeGhosts();
+1
View File
@@ -149,6 +149,7 @@ typedef struct demoghost {
UINT8 checksum[16];
UINT8 *buffer, *p, color;
UINT16 version;
boolean done;
mobj_t oldmo, *mo;
struct demoghost *next;
} demoghost;
+16 -14
View File
@@ -312,6 +312,8 @@ consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, N
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pausesongcredits = {"pausesongcredits", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Show "FREE PLAY" when you're alone. :(
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -662,7 +664,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming)>>16);
return (INT16)((*aiming) >> TICCMD_REDUCE);
}
INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
@@ -675,7 +677,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming)>>16);
return (INT16)((*aiming) >> TICCMD_REDUCE);
}
INT32 JoyAxis(axis_input_e axissel, UINT8 player)
@@ -959,7 +961,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching)
{
cmd->angleturn = (INT16)(lang >> 16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->aiming = G_ClipAimingPitch(&laim);
return;
}
@@ -967,7 +969,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// dumbass thing so we can use a few buttons but dont accidentally drive away
if (player->spectator || freecam)
{
cmd->angleturn = (INT16)(lang >> 16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
G_BuildLocalTiccmd(cmd, ssplayer, freecam);
// let lua override everything
@@ -1127,7 +1129,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim);
mousex = mousey = mlooky = 0;
mousex = mousey = 0;
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
@@ -1166,10 +1168,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing))) // Not a physical player
lang += (cmd->angleturn<<16);
lang += (cmd->angleturn << TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16);
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped)
{
@@ -1750,14 +1752,15 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
// Increment a viewpoint by offset from the current player. A negative value
// decrements.
//
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam)
{
INT32 *displayplayerp, oldview;
displayplayerp = &displayplayers[viewnum-1];
oldview = (*displayplayerp);
// turn off the freecam
camera[viewnum-1].freecam = false;
if (resetfreecam)
camera[viewnum-1].freecam = false;
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@@ -1771,7 +1774,7 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
// Ensures all viewpoints are valid
// Also demotes splitscreen down to one player.
//
void G_ResetViews(void)
void G_ResetViews(boolean resetfreecam)
{
UINT8 splits;
UINT8 viewd;
@@ -1795,7 +1798,7 @@ void G_ResetViews(void)
*/
for (viewd = 1; viewd <= splits; ++viewd)
{
G_AdjustView(viewd, 0, false);
G_AdjustViewEx(viewd, 0, false, resetfreecam);
}
}
@@ -1876,7 +1879,7 @@ void G_Ticker(boolean run)
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
// Use the leveltime sent in the player's ticcmd to determine control lag
cmd->latency = modeattacking ? 0 : min(((leveltime & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
cmd->latency = modeattacking ? 0 : min(((leveltime & TICCMD_LATENCYMASK) - cmd->latency) & TICCMD_LATENCYMASK, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
}
}
@@ -1884,7 +1887,6 @@ void G_Ticker(boolean run)
switch (gamestate)
{
case GS_LEVEL:
for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now.
{
if (demo.title)
+4 -3
View File
@@ -50,7 +50,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
extern consvar_t cv_songcredits;
extern consvar_t cv_songcredits, cv_pausesongcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
extern consvar_t cv_pauseifunfocused;
@@ -262,9 +262,10 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse);
INT32 G_CountPlayersPotentiallyViewable(boolean active);
void G_ResetViews(void);
void G_ResetViews(boolean resetfreecam);
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam);
#define G_AdjustView(v,o,oa) G_AdjustViewEx(v,o,oa, true)
void G_AddPlayer(INT32 playernum);
+15 -11
View File
@@ -34,7 +34,7 @@ static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"
static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}};
// mouse values are used once
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mousexsens = {"mousexsens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -125,17 +125,17 @@ static void led_off_handle4(void)
G_ResetPlayerGamepadIndicatorColor(3);
}
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
INT32 mousex = 0, mousey = 0;
// joystick values are repeated
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
INT32 joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
// current state of the keys: true if pushed
UINT8 gamekeydown[NUMINPUTS];
UINT8 gamekeydown[NUMINPUTS] = {};
// two key codes (or virtual key) per game control
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2] = {};
typedef struct
{
@@ -192,9 +192,8 @@ void G_MapEventsToControls(event_t *ev)
case ev_mouse: // buttons are virtual keys
if (menuactive || CON_Ready() || chat_on)
break;
mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f));
mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.value)/110.0f + 0.1f));
break;
case ev_joystick: // buttons are virtual keys
@@ -215,7 +214,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick3:
i = ev->data1;
if (i >= JOYAXISSET)
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
@@ -223,7 +222,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick4:
i = ev->data1;
if (i >= JOYAXISSET)
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
@@ -974,8 +973,13 @@ void G_DeviceLEDTick(void)
newcolor = G_GetSkinColorForGamepad(i);
// compiler be absolutely tripping
// delet this if this gets fixed within gcc
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
if (curcolor[i] == newcolor) // dont update if same colour
continue;
#pragma GCC diagnostic pop
G_SetPlayerGamepadIndicatorColor(i, newcolor);
curcolor[i] = newcolor;
+1 -2
View File
@@ -109,7 +109,7 @@ typedef enum
} gamecontrols_e;
// mouse values are used once
extern consvar_t cv_mousesens, cv_mouseysens;
extern consvar_t cv_mousexsens, cv_mouseysens;
extern consvar_t cv_controlperkey;
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
@@ -117,7 +117,6 @@ extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
+1 -1
View File
@@ -214,7 +214,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture;
const GLMipmap_t *texture2 = poly1->hash & 0x80000000 ? NULL : poly2->texture;
const GLMipmap_t *texture2 = poly2->hash & 0x80000000 ? NULL : poly2->texture;
// skywalls and horizon lines must retain their order for horizon lines to work
if (!texture1 && !texture2)
+120 -129
View File
@@ -642,8 +642,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
pv = planepoly->pts;
// reference point for flat texture coord for each vertex around the polygon
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize;
if (!isceiling) // it's a floor
{
@@ -660,9 +660,13 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (angle) // Only needs to be done if there's an altered angle
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
@@ -806,6 +810,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
}
}
}
#undef SETUP3DVERT
}
#ifdef WALLSPLATS
@@ -1365,8 +1370,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// x offset the texture
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
const float cliplow = (float)texturehpeg;
const float cliphigh = ((float)texturehpeg + (float)gl_curline->length);
const float cliplow = static_cast<float>(texturehpeg);
const float cliphigh = static_cast<float>(texturehpeg) + static_cast<float>(gl_curline->length);
FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1380,8 +1385,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL;
static constexpr float FLOATMAX = (float)INT32_MAX / (float)FRACUNIT;
static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT;
static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT);
static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT);
// two sided line
if (gl_backsector)
@@ -1494,8 +1499,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_toptexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1503,23 +1508,23 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY;
}
// set top/bottom coords
@@ -1556,8 +1561,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1565,22 +1570,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
}
// set top/bottom coords
@@ -1742,13 +1747,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_midtexture, noencore);
// Left side
wallVerts[3].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = static_cast<float>(h - l + texturevpeg) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
// Right side
wallVerts[2].t = texturevpegslope * glTex->scaleY;
wallVerts[1].t = (hS - lS + texturevpegslope) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(hS - lS + texturevpegslope) * glTex->scaleY;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// set top/bottom coords
@@ -1791,28 +1796,28 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
texturevpeg = gl_sidedef->rowoffset; // top of texture at top
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// Texture correction for slopes
if (gl_linedef->flags & ML_EFFECT2)
{
wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += static_cast<float>(gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY;
}
else
{
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - static_cast<float>(worldbottomslope - worldtopslope) * glTex->scaleY;
}
//Set textures properly on single sided walls that are sloped
@@ -1977,24 +1982,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
}
}
@@ -2137,24 +2142,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
}
}
@@ -2495,8 +2500,10 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
// Find the corners of the box
// that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5)
return true;
@@ -2616,6 +2623,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
@@ -2637,12 +2645,14 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
return;
}
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
// Allocate plane-vertex buffer if we need to
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
{
numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
Z_Free(planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof(FOutVector), PU_LEVEL, &planeVerts);
}
height = FixedToFloat(fixedheight);
@@ -2685,72 +2695,51 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
flatxref = FixedToFloat(polysector->origVerts[0].x);
flatyref = FixedToFloat(polysector->origVerts[0].y);
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize;
// transform
v3d = planeVerts;
if (FOFsector != NULL)
if (!isceiling) // it's a floor
{
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize;
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize;
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize;
angle = sec->floorpic_angle;
}
else if (gl_frontsector)
else // it's a ceiling
{
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize;
angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize;
angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize;
angle = sec->ceilingpic_angle;
}
if (angle) // Only needs to be done if there's an altered angle
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = FloatToFixed(scrollx);
tempytow = FloatToFixed(scrolly);
scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
tempxsow = FloatToFixed(flatxref);
tempytow = FloatToFixed(flatyref);
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
}
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++, v3d++)
{
// Hurdler: add scrolling texture on floor/ceiling
v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations
v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations
// Go from the polysector's original vertex locations
// Means the flat is offset based on the original vertex locations
v3d->s = ((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx);
v3d->t = (flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly);
// Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle
{
tempxsow = FloatToFixed(v3d->s);
tempytow = FloatToFixed(v3d->t);
v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
tempxsow = v3d->s;
tempytow = v3d->t;
v3d->s = (tempxsow * cosangf) - (tempytow * sinangf);
v3d->t = (tempxsow * sinangf) + (tempytow * cosangf);
}
v3d->x = FixedToFloat(polysector->vertices[i]->x);
@@ -3457,13 +3446,13 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset * this_scale - (floorheight+3);
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - static_cast<float>(gpatch->topoffset) * this_scale - static_cast<float>(floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
}
else
{
@@ -3471,10 +3460,10 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset - (floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + (gpatch->height + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
}
// We also need to move the bottom ones away when shadowoffs is on
@@ -5152,6 +5141,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
z2 = tr_y - x2 * rightsin;
x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos;
//y1 = tr_y + y1 * rightcos;
//y2 = tr_y - y2 * rightcos;
//
// store information in a vissprite
@@ -5330,7 +5321,7 @@ void HWR_BuildSkyDome(void)
}
// precompute to save a bit of division
static constexpr float FINEDEGREE = (360.0f/(float)FINEANGLES);
static constexpr float FINEDEGREE = (360.0f/static_cast<float>(FINEANGLES));
static void HWR_DrawSkyBackground(void)
{
@@ -5348,7 +5339,7 @@ static void HWR_DrawSkyBackground(void)
//04/01/2000: Hurdler: added for T&L
// It should replace all other gl_viewxxx when finished
HWR_SetTransformAiming(&dometransform);
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(FINEDEGREE);
dometransform.angley = static_cast<float>((viewangle-ANGLE_270) >> ANGLETOFINESHIFT)*(FINEDEGREE);
HWR_GetTexture(texturetranslation[skytexture], false);
@@ -5393,7 +5384,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
if (cv_glshearing.value)
{
fixed_t fixedaiming = AIMINGTODY(aimingangle);
trans->viewaiming = FixedToFloat(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(BASEVIDHEIGHT));
if (splitscreen == 1) // only for 2 player splitscreen
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
trans->shearing = true;
@@ -5405,7 +5396,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
gl_aimingangle = aimingangle;
}
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
}
void HWR_SetTransform(float fpov)
@@ -5424,11 +5415,11 @@ void HWR_SetTransform(float fpov)
atransform.z = gl_viewz;
atransform.scalex = 1;
atransform.scaley = (float)vid.width/vid.height;
atransform.scaley = static_cast<float>(vid.width) / static_cast<float>(vid.height);
atransform.scalez = 1;
HWR_SetTransformAiming(&atransform);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
yaw = 270.0f - atransform.angley;
inv_yaw = 180.0f - yaw;
@@ -5439,8 +5430,8 @@ void HWR_SetTransform(float fpov)
// 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));
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle >> ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle >> ANGLETOFINESHIFT));
}
atransform.fovangle = fpov; // Tails
@@ -5701,7 +5692,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
{
if (roll != 0)
{
tr->rollangle = roll / (float)ANG1;
tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1);
tr->roll = true;
tr->rollx = 1.0f;
tr->rollz = 0.0f;
@@ -6101,7 +6092,7 @@ static void HWR_DoPostProcessor(void)
for (y = 0; y < SCREENVERTS; y++)
{
// Change X position based on its Y position.
v[x][y][0] = x-4.5f + sinf(((disStart+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][1] = y-4.5f; // (y / scale)
}
}
+1 -7
View File
@@ -2209,16 +2209,10 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
UNIFORM_1(shader->uniforms[gluniform_light_contrast], shader_light_contrast, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], shader_light_backlight, pglUniform1f);
}
else
{
UNIFORM_3(shader->uniforms[gluniform_light_dir], 0, 0, 0, pglUniform3f);
UNIFORM_1(shader->uniforms[gluniform_light_contrast], 0, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], 0, pglUniform1f);
}
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], vid.width, vid.height, pglUniform2f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)vid.width, (GLfloat)vid.height, pglUniform2f);
#undef UNIFORM_1
#undef UNIFORM_2
+1 -1
View File
@@ -1731,7 +1731,7 @@ static void HU_drawChatLog(INT32 offset)
{
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
{
M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
M_DrawEmote(x+dx+2, y+dy+1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
dx += EMOTEWIDTH - charwidth;
}
j += emotelen;
+2 -2
View File
@@ -80,6 +80,8 @@ typedef struct
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
extern doomcom_t *doomcom;
#ifdef HOLEPUNCH
typedef struct
{
@@ -91,8 +93,6 @@ typedef struct
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
#endif
extern doomcom_t *doomcom;
/** \brief return packet in doomcom struct
*/
extern boolean (*I_NetGet)(void);
+6 -5
View File
@@ -568,13 +568,12 @@ void Command_Numnodes(void)
#ifdef HOLEPUNCH
/* not one of the reserved "local" addresses */
static boolean
is_external_address (UINT32 p)
static boolean is_external_address(UINT32 p)
{
UINT8 a = (p & 255);
UINT8 b = ((p >> 8) & 255);
if (p == (UINT32)~0)/* 255.255.255.255 */
if (p == (UINT32)~0) /* 255.255.255.255 */
return 0;
switch (a)
@@ -584,7 +583,7 @@ is_external_address (UINT32 p)
case 127:
return false;
case 172:
return (b & ~15) != 16;/* 16 - 31 */
return (b & ~15) != 16; /* 16 - 31 */
case 192:
return b != 168;
default:
@@ -763,6 +762,7 @@ static void SOCK_Send(void)
if (myfamily[i] == broadcastaddress[j].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET)
{
e = errno;
@@ -780,6 +780,7 @@ static void SOCK_Send(void)
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -792,6 +793,7 @@ static void SOCK_Send(void)
else
{
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -1060,7 +1062,6 @@ static boolean UDP_Socket(void)
#endif
const char *serv;
for (s = 0; s < mysocketses; s++)
mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++)
+1 -1
View File
@@ -568,7 +568,7 @@ static patch_t *kp_racefinish[6];
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
static patch_t *kp_winnernum[NUMPOSFRAMES];
static patch_t *kp_facenum[MAXPLAYERS+1];
patch_t *kp_facenum[MAXPLAYERS+1];
static patch_t *kp_facehighlight[8];
static patch_t *kp_rankbumper;
+3
View File
@@ -41,6 +41,9 @@ extern consvar_t cv_battlespeedo;
extern consvar_t cv_multiitemicon;
extern consvar_t cv_huditemamount;
// for use in timeattack menu
extern patch_t *kp_facenum[MAXPLAYERS+1];
#define NUMSPEEDOSTUFF 8
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
#define NUMDGAUGESTUFF 6
+50 -54
View File
@@ -5179,6 +5179,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
return wtarg;
}
static INT32 K_GetEngineClass(const player_t *player)
{
INT32 speed, weight;
speed = (player->kartspeed - 1) / 3;
weight = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(speed);
LOCKSTAT(weight);
#undef LOCKSTAT
return (speed + (3*weight));
}
// Engine Sounds.
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{
@@ -5189,7 +5207,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6
INT32 class, s, w; // engine class number
INT32 class; // engine class number
UINT8 volume = 255;
fixed_t volumedampen = FRACUNIT;
@@ -5225,7 +5243,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
}
if (targetsnd < 0) { targetsnd = 0; }
if (targetsnd < 0) { targetsnd = 0; }
if (targetsnd > 12) { targetsnd = 12; }
if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; }
@@ -5302,17 +5320,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
return;
}
s = (player->kartspeed - 1) / 3;
w = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(s);
LOCKSTAT(w);
#undef LOCKSTAT
class = s + (3*w);
class = K_GetEngineClass(player);
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume);
}
@@ -5731,7 +5739,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
// Plays the music during and after the starting countdown.
if (P_IsLocalPlayer(player))
if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player))
S_StartMapMusic();
}
@@ -5911,45 +5919,33 @@ static void K_KartDrift(player_t *player, boolean onground)
// Holding the Jump button will enable drifting.
// Drift Release (Moved here so you can't "chain" drifts)
if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsone
&& onground)
if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
{
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
&& onground)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsthree
&& onground)
{
if (player->kartstuff[k_driftboost] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] >= dsthree
&& onground)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
if (player->kartstuff[k_driftcharge] < dsone)
{
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] < dsthree)
{
if (player->kartstuff[k_driftboost] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsthree)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
}
// Drifting: left or right?
@@ -6027,8 +6023,8 @@ static void K_KartDrift(player_t *player, boolean onground)
// Sound whenever you get a different tier of sparks
if (driftblue
|| driftred
|| driftrainbow)
|| driftred
|| driftrainbow)
{
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
+65 -10
View File
@@ -149,7 +149,8 @@ enum cameraf {
camera_momx,
camera_momy,
camera_momz,
camera_pnum
camera_pnum,
camera_freecam,
};
@@ -169,6 +170,7 @@ static const char *const camera_opt[] = {
"momy",
"momz",
"pnum",
"freecam",
NULL};
enum hudpatch {
@@ -387,10 +389,43 @@ static int camera_get(lua_State *L)
case camera_pnum:
lua_pushinteger(L, camnum);
break;
case camera_freecam:
lua_pushboolean(L, cam->freecam);
break;
}
return 1;
}
static int lib_getCamera(lua_State *L)
{
// No cameras on dedicated
if (dedicated)
return 0;
if (lua_type(L, 2) == LUA_TNUMBER)
{
int i = lua_tonumber(L, 2);
if (i < 0 || i > splitscreen)
return 0;
LUA_PushUserdata(L, &camera[i], META_CAMERA);
return 1;
}
return 0;
}
static int lib_lenCamera(lua_State *L)
{
if (dedicated)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, splitscreen+1); // splitscreen == 0 -> 1 active camera, splitscreen == 1 -> 2 cameras and so on
return 1;
}
//
// lib_draw
//
@@ -1252,22 +1287,32 @@ extern int lib_hudadd(lua_State *L);
static int lib_hudsetvotebackground(lua_State *L)
{
// Reset to default
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
VoteScreen.timePerAnimFrame = 2;
if (lua_isnoneornil(L, 1))
if (!lua_isnoneornil(L, 1))
{
return 0;
const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
}
const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
if (!lua_isnoneornil(L, 2))
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
INT32 time_per_frame = luaL_checkinteger(L, 2);
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
if (time_per_frame <= 0)
return luaL_argerror(L, 2, "time per frame should be 1 or more");
VoteScreen.timePerAnimFrame = time_per_frame;
}
// Update background if we're already on vote screen
if (gamestate == GS_VOTING)
@@ -1371,6 +1416,16 @@ int LUA_HudLib(lua_State *L)
lua_setfield(L, -2, "__index");
lua_pop(L,1);
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getCamera);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lib_lenCamera);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "cameras");
camera_fields_ref = Lua_CreateFieldTable(L, camera_opt);
luaL_register(L, "hud", lib_hud);
+1 -1
View File
@@ -908,7 +908,7 @@ void OP_ObjectplaceMovement(player_t *player)
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
+289 -214
View File
@@ -197,7 +197,30 @@ static INT32 vidm_column_size;
#define SETUPM_IP_MAXSIZE ((28-1)*8)
static char setupm_ip[64];
static textinput_t setupm_input_ip;
static UINT8 setupm_pselect = 1;
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
static char setupm_name[MAXPLAYERNAME+1];
static textinput_t setupm_input;
static player_t *setupm_player;
static consvar_t *setupm_cvskin;
static consvar_t *setupm_cvcolor;
static consvar_t *setupm_cvname;
static UINT8 setupm_skinxpos;
static INT32 setupm_fakeskin;
static INT32 setupm_fakecolor;
static UINT8 setupm_pselect = 1;
//variables used for other skin select menus
static UINT8 setupm_skinypos;
static INT32 setupm_skinselect;
static boolean setupm_skinlockedselect;
static UINT8 setupm_playernum; //brap
//
// PROTOTYPES
@@ -233,6 +256,7 @@ static char *M_GetConditionString(condition_t cond);
// Misc. Main Menu
static void M_Options(INT32 choice);
static void M_Multiplayer(INT32 choice);
static void M_CameraMenu(INT32 choice);
static void M_LocalSkinMenu(INT32 choice);
static void M_LocalSkinChange(INT32 choice);
static void M_Manual(INT32 choice);
@@ -625,22 +649,28 @@ void Nextmap_OnChange(void)
SP_ReplayMenu[i].status = IT_DISABLED;
SP_GuestReplayMenu[i].status = IT_DISABLED;
}
SP_ReplayMenu[4].status = IT_DISABLED;
SP_GhostMenu[3].status = IT_DISABLED;
SP_GhostMenu[4].status = IT_DISABLED;
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string))) {
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_chooseskin.string)))
{
SP_ReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string))) {
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_chooseskin.string)))
{
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string))) {
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_chooseskin.string)))
{
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
active |= 3;
@@ -663,7 +693,8 @@ void Nextmap_OnChange(void)
active |= 1;
}
if (active) {
if (active)
{
if (active & 1)
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
if (active & 2)
@@ -775,6 +806,11 @@ static void Splitplayers_OnChange(void)
setupm_pselect = 1;
}
void ShowLocalskinMenu_Onchange(void)
{
OP_MainMenu[localskin].status = (!cv_showlocalskinmenus.value) ? (IT_DISABLED) : (IT_CALL|IT_STRING);
}
// current menudef
menu_t *currentMenu = &MainDef;
@@ -895,7 +931,7 @@ static void M_CheckStringItem(void)
// special case: name input, cap it to prevent writing outside the textbox
// kinda ugly but itll work
if (cv == &cv_playername)
if (cv == setupm_cvname)
M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1);
else
M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf);
@@ -1006,18 +1042,6 @@ boolean M_Responder(event_t *ev)
ch = KEY_RIGHTARROW;
break;
}
if (menuactive)
{
if (currentMenu == &MISC_ChangeLevelDef || currentMenu == &MP_OfflineServerDef || currentMenu == &MP_ServerDef)
{
if (ch == gamecontrol[0][gc_fire][0]
|| ch == gamecontrol[0][gc_fire][1])
{
COM_ImmedExecute("add kartencore 1");
}
}
}
}
else if (menuactive)
{
@@ -1209,6 +1233,19 @@ boolean M_Responder(event_t *ev)
if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
ch = KEY_ESCAPE;
if (currentMenu == &MISC_ChangeLevelDef ||
currentMenu == &MP_OfflineServerDef ||
currentMenu == &MP_ServerDef)
{
if (ch == gamecontrol[0][gc_fire][0]
|| ch == gamecontrol[0][gc_fire][1])
{
if (M_SecretUnlocked(SECRET_ENCORE))
COM_ImmedExecute("add kartencore 1");
return true;
}
}
routine = currentMenu->menuitems[itemOn].itemaction;
// Handle menuitems which need a specific key handling
@@ -1939,8 +1976,6 @@ void M_Ticker(void)
}
I_unlock_mutex(ms_ServerList_mutex);
#endif
CL_TimeoutServerList();
}
//
@@ -2697,6 +2732,12 @@ static void M_DrawPauseMenu(void)
}
#endif
musicdef_t *def;
if (cv_pausesongcredits.value && (def = S_FindMusicCredit(S_MusicName())) != NULL)
{
V_DrawThinString(2, 2, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x1F"" %s", def->source));
}
M_DrawGenericMenu();
}
@@ -3360,8 +3401,6 @@ static void M_DrawTemperature(INT32 x, fixed_t t)
// bounds check
if (t > FRACUNIT)
t = FRACUNIT;
/*else if (t < 0) -- not needed
t = 0;*/
// scale
if (t > 1)
@@ -3968,6 +4007,7 @@ menudemo_t *demolist = NULL; // Replays that that have been checked to match wit
// Locked behind Lock_search_state
menudemo_t *demolist_all = NULL; // All replays
size_t demolist_all_size = 0;
boolean replaynamesloaded = false;
#ifdef HAVE_THREADS
@@ -4000,14 +4040,14 @@ static void ReplayNamesLoadThread(void* userdata)
{
Lock_search_state();
size_t demolist_all_size = sizedirmenu;
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*sizedirmenu);
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*sizedirmenu);
size_t demolist_all_size_local = demolist_all_size;
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*demolist_all_size_local);
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*demolist_all_size_local);
char *replaydirpath = (char*)userdata;
Unlock_search_state();
for (size_t i = 0; i < demolist_all_size; ++i)
for (size_t i = 0; i < demolist_all_size_local; ++i)
{
if (demolist_all_local[i].type != MD_SUBDIR)
{
@@ -4023,9 +4063,9 @@ static void ReplayNamesLoadThread(void* userdata)
Lock_search_state();
if (fastcmp(menupath, replaydirpath))
if (fastcmp(menupath, replaydirpath) && demolist_all)
{
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*demolist_all_size);
replaynamesloaded = true;
}
@@ -4159,6 +4199,7 @@ static void PrepReplayList(boolean reset)
Z_Free(demolist_all);
demolist_all = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
demolist_all_size = sizedirmenu;
for (i = 0; i < sizedirmenu; i++)
{
@@ -4207,6 +4248,7 @@ void M_ReplayHut(INT32 choice)
}
else if (!demo.inreplayhut)
dir_on[menudepthleft] = 0;
demo.inreplayhut = true;
replayScrollTitle = 0; replayScrollDelay = TICRATE; replayScrollDir = 1;
@@ -4298,6 +4340,9 @@ static void M_HandleReplayHutList(INT32 choice)
if (!replaynamesloaded)
return;
if (replayqueryfound == 0)
return;
switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE])
{
case EXT_FOLDER:
@@ -4396,136 +4441,140 @@ static void DrawReplayHutReplayInfo(void)
UINT8 *colormap;
INT32 x, y, w, h;
switch (demolist[dir_on[menudepthleft]].type)
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
switch (replaydemolist->type)
{
case MD_NOTLOADED:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
break;
case MD_INVALID:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
break;
case MD_SUBDIR:
break; // Can't think of anything to draw here right now
case MD_OUTDATED:
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", demolist[dir_on[menudepthleft]].version));
/* FALLTHRU */
default:
// Draw level stuff
x = 15; y = 15;
// A 160x100 image of the level as entry MAPxxP
//CONS_Printf("%d %s\n", demolist[dir_on[menudepthleft]].map, G_BuildMapName(demolist[dir_on[menudepthleft]].map));
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(demolist[dir_on[menudepthleft]].map)));
if (lumpnum != LUMPERROR)
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
else
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
if (!(demolist[dir_on[menudepthleft]].kartspeed & DF_ENCORE))
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
else
{
w = patch->width;
h = patch->height;
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
x += 85;
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
{
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
INT32 datew = 0;
if (demolist[dir_on[menudepthleft]].date[0] != '\0')
{
datew = V_StringWidth(demolist[dir_on[menudepthleft]].date, 0);
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", demolist[dir_on[menudepthleft]].date));
}
if (demolist[dir_on[menudepthleft]].numlaps)
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", demolist[dir_on[menudepthleft]].numlaps));
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].gametype == GT_RACE ?
va("Race (%s speed)", kartspeed_cons_t[demolist[dir_on[menudepthleft]].kartspeed & ~DF_ENCORE].strvalue) :
"Battle Mode");
if (!demolist[dir_on[menudepthleft]].standings[0].ranking)
{
// No standings were loaded!
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
case MD_NOTLOADED:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
break;
}
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name);
case MD_INVALID:
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
break;
if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
}
else
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
}
case MD_SUBDIR:
break; // Can't think of anything to draw here right now
if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1))
{
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
}
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
{
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[0].timeorscore, true),
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore),
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[0].timeorscore)
));
}
else
{
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[0].timeorscore));
}
case MD_OUTDATED:
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, va("Recorded on an outdated version. %s", replaydemolist->version));
/* FALLTHRU */
default:
// Draw level stuff
x = 15; y = 15;
// Character face!
if (demolist[dir_on[menudepthleft]].standings[0].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR)
{
patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin];
colormap = R_GetTranslationColormap(
demolist[dir_on[menudepthleft]].standings[0].skin,
demolist[dir_on[menudepthleft]].standings[0].color,
GTC_MENUCACHE);
}
else
{
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
demolist[dir_on[menudepthleft]].standings[0].color,
GTC_MENUCACHE);
}
// A 160x100 image of the level as entry MAPxxP
//CONS_Printf("%d %s\n", replaydemolist->map, G_BuildMapName(replaydemolist->map));
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(replaydemolist->map)));
if (lumpnum != LUMPERROR)
patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);
else
patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH);
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
if (!(replaydemolist->kartspeed & DF_ENCORE))
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
else
{
w = patch->width;
h = patch->height;
V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch);
break;
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, (patch_t *)W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
x += 85;
if (mapheaderinfo[replaydemolist->map-1])
{
char *title = G_BuildMapTitle(replaydemolist->map);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
INT32 datew = 0;
if (replaydemolist->date[0] != '\0')
{
datew = V_StringWidth(replaydemolist->date, 0);
V_DrawThinString(x, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("%s", replaydemolist->date));
}
if (replaydemolist->numlaps)
V_DrawThinString(x+datew, y+9, V_SNAPTOTOP|V_ALLOWLOWERCASE, va("(%d laps)", replaydemolist->numlaps));
V_DrawString(x, y+20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->gametype == GT_RACE ?
va("Race (%s speed)", kartspeed_cons_t[replaydemolist->kartspeed & ~DF_ENCORE].strvalue) :
"Battle Mode");
if (!replaydemolist->standings[0].ranking)
{
// No standings were loaded!
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
break;
}
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[0].name);
if (replaydemolist->gametype == GT_RACE)
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
}
else
{
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
}
const UINT32 timeorscore = replaydemolist->standings[0].timeorscore;
if (timeorscore == (UINT32_MAX-1))
{
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
}
else if (replaydemolist->gametype == GT_RACE)
{
V_DrawRightAlignedString(x+84, y+40, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(timeorscore, true),
G_TicsToSeconds(timeorscore),
G_TicsToCentiseconds(timeorscore)
));
}
else
{
V_DrawString(x+32, y+40, V_SNAPTOTOP, va("%d", timeorscore));
}
// Character face!
if (replaydemolist->standings[0].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[0].skin].facewant) != LUMPERROR)
{
patch = facewantprefix[replaydemolist->standings[0].skin];
colormap = R_GetTranslationColormap(
replaydemolist->standings[0].skin,
replaydemolist->standings[0].color,
GTC_MENUCACHE);
}
else
{
patch = (patch_t *)W_CachePatchName("M_NOWANT", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
replaydemolist->standings[0].color,
GTC_MENUCACHE);
}
V_DrawMappedPatch(BASEVIDWIDTH-15 - patch->width, y+20, V_SNAPTOTOP, patch, colormap);
break;
}
}
@@ -4591,7 +4640,7 @@ static void M_DrawReplayHut(void)
if (i == itemOn)
cursory = localy;
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
if ((currentMenu->menuitems[i].status & IT_DISPLAY) == IT_STRING)
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT, currentMenu->menuitems[i].text);
else
V_DrawString(x, localy, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[i].text);
@@ -4671,8 +4720,7 @@ static void M_DrawReplayHut(void)
}
// Draw the cursor
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT,
(patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text);
// Now draw some replay info!
@@ -4704,34 +4752,38 @@ static void M_DrawReplayStartMenu(void)
M_DrawGenericBackgroundMenu();
const menudemo_t *replaydemolist = &demolist[dir_on[menudepthleft]];
#define STARTY 62-(replayScrollTitle>>1)
// Draw rankings beyond first
for (i = 1; i < MAXPLAYERS && demolist[dir_on[menudepthleft]].standings[i].ranking; i++)
for (i = 1; i < MAXPLAYERS && replaydemolist->standings[i].ranking; i++)
{
patch_t *patch;
UINT8 *colormap;
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", demolist[dir_on[menudepthleft]].standings[i].ranking));
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[i].name);
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20, V_SNAPTOTOP|highlightflags, va("%2d", replaydemolist->standings[i].ranking));
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_SNAPTOTOP|V_ALLOWLOWERCASE, replaydemolist->standings[i].name);
if (demolist[dir_on[menudepthleft]].standings[i].timeorscore == UINT32_MAX-1)
const UINT32 timeorscore = replaydemolist->standings[i].timeorscore;
if (timeorscore == UINT32_MAX-1)
V_DrawThinString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, "NO CONTEST");
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
else if (replaydemolist->gametype == GT_RACE)
V_DrawRightAlignedString(BASEVIDWIDTH-40, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d'%02d\"%02d",
G_TicsToMinutes(demolist[dir_on[menudepthleft]].standings[i].timeorscore, true),
G_TicsToSeconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore),
G_TicsToCentiseconds(demolist[dir_on[menudepthleft]].standings[i].timeorscore)
G_TicsToMinutes(timeorscore, true),
G_TicsToSeconds(timeorscore),
G_TicsToCentiseconds(timeorscore)
));
else
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[i].timeorscore));
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", timeorscore));
// Character face!
if (demolist[dir_on[menudepthleft]].standings[i].skin < numskins && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR)
if (replaydemolist->standings[i].skin < numskins && W_CheckNumForName(skins[replaydemolist->standings[i].skin].facerank) != LUMPERROR)
{
patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin];
patch = facerankprefix[replaydemolist->standings[i].skin];
colormap = R_GetTranslationColormap(
demolist[dir_on[menudepthleft]].standings[i].skin,
demolist[dir_on[menudepthleft]].standings[i].color,
replaydemolist->standings[i].skin,
replaydemolist->standings[i].color,
GTC_MENUCACHE);
}
else
@@ -4739,7 +4791,7 @@ static void M_DrawReplayStartMenu(void)
patch = (patch_t *)W_CachePatchName("M_NORANK", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
demolist[dir_on[menudepthleft]].standings[i].color,
replaydemolist->standings[i].color,
GTC_MENUCACHE);
}
@@ -4776,10 +4828,10 @@ static void M_DrawReplayStartMenu(void)
V_DrawFill(10, 10, 300, 60, V_SNAPTOTOP|239);
DrawReplayHutReplayInfo();
V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].title);
V_DrawString(10, 72, V_SNAPTOTOP|highlightflags|V_ALLOWLOWERCASE, replaydemolist->title);
// Draw a warning prompt if needed
switch (demolist[dir_on[menudepthleft]].addonstatus)
switch (replaydemolist->addonstatus)
{
case DFILE_ERROR_CANNOTLOAD:
warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur.";
@@ -4808,6 +4860,9 @@ static void M_DrawReplayStartMenu(void)
void M_ResetDemoList(void)
{
Lock_search_state();
replaynamesloaded = false;
Z_Free(demolist_all);
demolist_all = NULL;
@@ -4815,6 +4870,8 @@ void M_ResetDemoList(void)
demolist = NULL;
demo.inreplayhut = false;
Unlock_search_state();
}
static boolean M_QuitReplayHut(void)
@@ -4827,6 +4884,16 @@ static boolean M_QuitReplayHut(void)
return true;
}
// same as M_QuitReplayHut, but calls M_StopMessage
void M_ReturnToTitleFromError(void)
{
M_StopMessage(0);
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
menuactive = false;
D_StartTitle();
M_ResetDemoList();
}
static void M_HutStartReplay(INT32 choice)
{
(void)choice;
@@ -6191,11 +6258,27 @@ void M_DrawTimeAttackMenu(void)
SHOWMODDEDGAME
const INT32 skinnum = max(cv_chooseskin.value-1, 0); // dont think its needed but better safe than sorry!
const skin_t *skin = &skins[skinnum];
// Character face!
if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR)
if (W_CheckNumForName(skin->facewant) != LUMPERROR)
{
UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE);
V_DrawMappedPatch(BASEVIDWIDTH-x - facewantprefix[cv_chooseskin.value-1]->width, y, 0, facewantprefix[cv_chooseskin.value-1], colormap);
const INT32 charx = (BASEVIDWIDTH-x - facewantprefix[skinnum]->width);
UINT8 *colormap = NULL;
colormap = R_GetTranslationColormap(skinnum, cv_playercolor.value, GTC_MENUCACHE);
V_DrawMappedPatch(charx, y, 0, facewantprefix[skinnum], colormap);
// draw stats
// speed
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE);
V_DrawFixedPatch((charx-6) << FRACBITS, (y-5) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartspeed))], colormap);
// weight
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE);
V_DrawFixedPatch((charx+25) << FRACBITS, (y+25) << FRACBITS, 3*FRACUNIT/2, 0, kp_facenum[min(9, max(1, skin->kartweight))], colormap);
// idk if kp_facenum are the best numbers for this case? but works with some scaling lul
}
for (i = 0; i < currentMenu->numitems; ++i)
@@ -6225,7 +6308,7 @@ void M_DrawTimeAttackMenu(void)
}
else
{
const char *str = ((cv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : cv->string);
const char *str = ((cv == &cv_chooseskin) ? skin->realname : cv->string);
INT32 soffset = 40, strw = V_StringWidth(str, 0);
// hack to keep the menu from overlapping the level icon
@@ -6270,10 +6353,12 @@ void M_DrawTimeAttackMenu(void)
{
tic_t lap = 0, time = 0;
if (mainrecords[cv_nextmap.value-1])
const recorddata_t *currecord = mainrecords[cv_nextmap.value-1];
if (currecord)
{
lap = mainrecords[cv_nextmap.value-1]->lap;
time = mainrecords[cv_nextmap.value-1]->time;
lap = currecord->lap;
time = currecord->time;
}
V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239);
@@ -6295,6 +6380,7 @@ void M_DrawTimeAttackMenu(void)
y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey;
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text);
ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction;
if (SP_TimeAttackMenu[i].status & IT_CV_STRING)
{
M_DrawTextBox(x + 32, y - 8, MAXPLAYERNAME, 1);
@@ -6302,7 +6388,7 @@ void M_DrawTimeAttackMenu(void)
}
else
{
const char *str = ((ncv == &cv_chooseskin) ? skins[cv_chooseskin.value-1].realname : ncv->string);
const char *str = ((ncv == &cv_chooseskin) ? skin->realname : ncv->string);
INT32 soffset = 40, strw = V_StringWidth(str, 0);
// hack to keep the menu from overlapping the level icon
@@ -6807,12 +6893,22 @@ static void M_Connect(INT32 choice)
COM_BufAddText(va("connect node %d\n", serverlist[serverlistsearched[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE]].node));
}
static void M_ResetServerList(void)
{
serverlistpage = 0;
oldserverlistpage = 0;
serverlistslidex = 0.0f;
memset(serverlistsearched, 0, sizeof(serverlistsearched));
serverlistsearchedcount = 0;
}
static void M_Refresh(INT32 choice)
{
(void)choice;
// first page of servers
serverlistpage = 0;
M_ResetServerList();
CL_UpdateServerList();
@@ -6843,14 +6939,7 @@ static void M_DrawServerCountAndHorizontalBar(void)
break;
default:
if (serverlistultimatecount > serverlistcount)
{
text = va("%d/%d servers found%.*s",
serverlistcount,
serverlistultimatecount,
I_GetTime() / NEWTICRATE % 4, "...");
}
else if (serverlistcount > 0)
if (serverlistcount > 0)
{
text = va("%d servers found", serverlistcount);
}
@@ -7034,7 +7123,7 @@ static int ServerListEntryComparator_modified(const void *entry1, const void *en
void M_SortServerList(void)
{
switch(cv_serversort.value)
switch (cv_serversort.value)
{
case 0: // Ping.
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_time);
@@ -7109,7 +7198,7 @@ static void M_ConnectMenu(INT32 choice)
// we don't request a restart unless the filelist differs
// first page of servers
serverlistpage = 0;
M_ResetServerList();
CL_UpdateServerList();
@@ -7327,7 +7416,8 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
patch_t *PictureOfLevel;
INT32 x, y, w, i, oldval, trans, dupadjust = (vid.scaledwidth - BASEVIDWIDTH)>>1;
if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu
// so it doesent show in record attack menu
if (levellistmode != LLM_RECORDATTACK && M_SecretUnlocked(SECRET_ENCORE)) // gotta have it unlocked first ofc
{
char encoretoggle[32] = {0};
const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL;
@@ -7820,28 +7910,6 @@ static void M_HandleConnectIP(INT32 choice)
// ========================
// Tails 03-02-2002
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
static char setupm_name[MAXPLAYERNAME+1];
static textinput_t setupm_input;
static player_t *setupm_player;
static consvar_t *setupm_cvskin;
static consvar_t *setupm_cvcolor;
static consvar_t *setupm_cvname;
static UINT8 setupm_skinxpos;
static INT32 setupm_fakeskin;
static INT32 setupm_fakecolor;
//variables used for other skin select menus
static UINT8 setupm_skinypos;
static INT32 setupm_skinselect;
static boolean setupm_skinlockedselect;
static UINT8 setupm_playernum; //brap
#define SELECTEDSTATSCOUNT skinstatscount[setupm_skinxpos][setupm_skinypos]
#define LASTSELECTEDSTAT skinstats[setupm_skinxpos][setupm_skinypos][skinstatscount[setupm_skinxpos][setupm_skinypos]]
@@ -8899,9 +8967,6 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
multi_state = cv_skinselectspin.value == SKINSELECTSPIN_PAIN ? &states[S_KART_PAIN] : &states[mobjinfo[MT_PLAYER].seestate];
multi_tics = multi_state->tics*FRACUNIT;
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
M_TextInputSetString(&setupm_input, cv_playername.string);
switch (pnum)
{
case 1:
@@ -8930,6 +8995,9 @@ static void M_DoSetupMultiPlayer(UINT8 pnum)
break;
}
M_TextInputInit(&setupm_input, setupm_name, sizeof(setupm_name));
M_TextInputSetString(&setupm_input, setupm_cvname->string);
setupm_skinxpos = 4;
setupm_skinypos = 0;
setupm_skinlockedselect = false;
@@ -9724,6 +9792,13 @@ static void M_DrawHUDOptions(void)
V_DrawRightAlignedString(x, y, highlightflags, "(");
}
static void M_CameraMenu(INT32 choice)
{
(void)choice;
OP_CamOptionsDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_CamOptionsDef);
}
static void M_LocalSkinMenu(INT32 choice)
{
(void)choice;
+3
View File
@@ -301,12 +301,15 @@ void SaturnHud_menu_Onchange(void);
void GameFocus_menu_Onchange (void);
void ShowLocalskinMenu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice);
void M_ReturnToTitleFromError(void);
void M_SetPlaybackMenuPointer(void);
void Nextmap_OnChange(void);
+46 -44
View File
@@ -600,7 +600,7 @@ static menuitem_t OP_MainMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Game Focus Options...", &OP_FocusOptionsDef, 33},
{IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 46},
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 56},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 56},
{IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 66},
{IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 76},
@@ -610,7 +610,7 @@ static menuitem_t OP_MainMenu[] =
{IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 109},
{IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 119},
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...",&OP_AccessibilityDef, 132},
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...", &OP_AccessibilityDef, 132},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 142},
{IT_SUBMENU|IT_STRING, NULL, "Bird...", &OP_BirdDef, 152},
@@ -800,7 +800,7 @@ static menuitem_t OP_MouseOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousexsens, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50},
};
@@ -1325,13 +1325,14 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95},
// highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 110 (see M_DrawHUDOptions)
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Console Prints in Menu",&cons_consoleprintinmenu, 130},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 145},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 155},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
};
static menuitem_t OP_CamOptionsMenu[] =
@@ -1645,7 +1646,7 @@ static menuitem_t OP_AccessibilityMenu[] =
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
{IT_HEADER, NULL, "Audio", NULL, 75},
@@ -1848,15 +1849,16 @@ static menuitem_t OP_SaturnHudMenu[] =
{IT_STRING|IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150},
{IT_STRING|IT_CVAR, NULL, "Music Credits", &cv_songcredits, 160},
{IT_STRING|IT_CVAR, NULL, "Music Credits on Pause", &cv_pausesongcredits, 165},
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 170},
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 175},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 185},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 195},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 200},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 210},
};
static const char* OP_SaturnHudTooltips[] =
@@ -1883,6 +1885,7 @@ static const char* OP_SaturnHudTooltips[] =
"Erratically rotate player icons during spinouts.",
"Visualize the player facing angle.",
"Show the Music Credits and which style.",
"Show the Music Credits while in pause menu.",
"Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.",
"Show the Director Toggle prompt when spectating.",
"Nametag Options.",
@@ -1970,47 +1973,46 @@ static menuitem_t OP_HudOffsetMenu[] =
// absolutely crazy how many people put work into this at this point <3
static menuitem_t OP_SaturnCreditsMenu[] =
{
// in no particular order besides me and indev <3
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", NULL, 80},
{IT_HEADER, NULL, "", NULL, 124},
{IT_HEADER, NULL, "", NULL, 74},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "jin Mompi", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Phoenix", NULL, 150},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Legacy", NULL, 160},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Classic", NULL, 170},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 190},
{IT_STRING+IT_SPACE, NULL, "", NULL, 198}, // dummy text I
{IT_STRING, NULL, "", NULL, 258}, // dummy text II
{IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I
{IT_STRING, NULL, "", NULL, 278}, // dummy text II
};
// sry we dont have space for this anymore :c
/*static const char* OP_CreditTooltips[] =
// sry we dont have space for this anymore :c < now we have again, for now..... TODO: finally stop being a lazy ass and make a cool credits screen
static const char* OP_CreditTooltips[] =
{
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
// this sucks lol note to self: we need as many NULLs as we have entries in OP_SaturnCreditsMenu - 1
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
"Thanks everyone! <3"
};*/
};
static menuitem_t OP_BirdMenu[] =
@@ -2617,7 +2619,7 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &O
menu_t OP_AccessibilityDef = DEFAULTSCROLLSTYLE(NULL, OP_AccessibilityMenu, &OP_MainDef, 30, 30, OP_AccessibilityTooltips);
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips);
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0, NULL); // OP_CreditTooltips no space :c
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 2, OP_CreditTooltips); // OP_CreditTooltips no space :c
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips);
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
+1 -2
View File
@@ -687,8 +687,7 @@ void T_ContinuousFalling(levelspecthink_t *faller)
// P_SectorCheckWater
//
// Like P_MobjCheckWater, but takes a sector instead of a mobj.
static fixed_t P_SectorCheckWater(sector_t *analyzesector,
sector_t *elevatorsec)
static fixed_t P_SectorCheckWater(sector_t *analyzesector, sector_t *elevatorsec)
{
fixed_t watertop;
+1 -6
View File
@@ -285,7 +285,7 @@ typedef struct mobj_s
// Info for drawing: position.
fixed_t x, y, z;
fixed_t old_x, old_y, old_z; // position interpolation
fixed_t old_x2, old_y2, old_z2;
fixed_t old_z2; // ok guess we need that...
// More list: links in sector (if needed)
struct mobj_s *bnext;
@@ -297,7 +297,6 @@ typedef struct mobj_s
// More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
angle_t old_angle2, old_pitch2, old_roll2;
angle_t rollangle;
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
@@ -307,9 +306,7 @@ typedef struct mobj_s
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
fixed_t old_spritexscale2, old_spriteyscale2;
fixed_t old_spritexoffset, old_spriteyoffset;
fixed_t old_spritexoffset2, old_spriteyoffset2;
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
fixed_t realxscale, realyscale; // funn-E streeetch
@@ -320,7 +317,6 @@ typedef struct mobj_s
//sloperollangle
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
angle_t old_sloperoll2, old_slopepitch2;
angle_t pitch_sprite, roll_sprite;
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -395,7 +391,6 @@ typedef struct mobj_s
fixed_t scale;
fixed_t old_scale; // interpolation
fixed_t old_scale2;
fixed_t destscale;
fixed_t scalespeed;
+4 -4
View File
@@ -680,11 +680,11 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
if (i == numlevelflats)
{
// store the name
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
strupr(levelflat->name);
// store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat);
@@ -727,11 +727,11 @@ INT32 P_AddLevelFlatRuntime(const char *flatname)
levelflat = levelflats+i;
// store the name
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
strupr(levelflat->name);
// store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat);
+6 -111
View File
@@ -53,7 +53,7 @@ mobj_t *skyboxmo[2] = {};
#define MAXFLATSIZE (2048<<FRACBITS)
/** Animated texture definition.
* Used for ::harddefs and for loading an ANIMATED lump from a wad.
* Used for loading an ANIMATED lump from a wad.
*
* Animations are defined by the first and last frame (i.e., flat or texture).
* The animation sequence uses all flats between the start and end entry, in
@@ -97,104 +97,6 @@ anim_t *lastanim = NULL;
anim_t *anims = NULL; /// \todo free leak
static size_t maxanims;
//
// P_InitPicAnims
//
/** Hardcoded animation sequences.
* Used if no ANIMATED lump is found in a loaded wad.
*/
static animdef_t harddefs[] =
{
// flat animations.
{false, "LITEY3", "LITEY1", 4},
{false, "FWATER16", "FWATER1", 4},
{false, "BWATER16", "BWATER01", 4},
{false, "LWATER16", "LWATER1", 4},
{false, "WATER7", "WATER0", 4},
{false, "LAVA4", "LAVA1", 8},
{false, "DLAVA4", "DLAVA1", 8},
{false, "RLAVA8", "RLAVA1", 8},
{false, "LITER3", "LITER1", 8},
{false, "SURF08", "SURF01", 4},
{false, "CHEMG16", "CHEMG01", 4}, // THZ Chemical gunk
{false, "GOOP16", "GOOP01", 4}, // Green chemical gunk
{false, "OIL16", "OIL01", 4}, // Oil
{false, "THZBOXF4", "THZBOXF1", 2}, // Moved up with the flats
{false, "ALTBOXF4", "ALTBOXF1", 2},
{false, "LITEB3", "LITEB1", 4},
{false, "LITEN3", "LITEN1", 4},
{false, "ACZRFL1H", "ACZRFL1A", 4},
{false, "ACZRFL2H", "ACZRFL2A", 4},
{false, "EGRIDF3", "EGRIDF1", 4},
{false, "ERZFAN4", "ERZFAN1", 1},
{false, "ERZFANR4", "ERZFANR1", 1},
{false, "DISCO4", "DISCO1", 15},
// animated textures
{true, "GFALL4", "GFALL1", 2}, // Short waterfall
{true, "CFALL4", "CFALL1", 2}, // Long waterfall
{true, "TFALL4", "TFALL1", 2}, // THZ Chemical fall
{true, "AFALL4", "AFALL1", 2}, // Green Chemical fall
{true, "QFALL4", "QFALL1", 2}, // Quicksand fall
{true, "Q2FALL4", "Q2FALL1", 2},
{true, "Q3FALL4", "Q3FALL1", 2},
{true, "Q4FALL4", "Q4FALL1", 2},
{true, "Q5FALL4", "Q5FALL1", 2},
{true, "Q6FALL4", "Q6FALL1", 2},
{true, "Q7FALL4", "Q7FALL1", 2},
{true, "LFALL4", "LFALL1", 2},
{true, "MFALL4", "MFALL1", 2},
{true, "OFALL4", "OFALL1", 2},
{true, "DLAVA4", "DLAVA1", 8},
{true, "ERZLASA2", "ERZLASA1", 1},
{true, "ERZLASB4", "ERZLASB1", 1},
{true, "ERZLASC4", "ERZLASC1", 1},
{true, "THZBOX04", "THZBOX01", 2},
{true, "ALTBOX04", "ALTBOX01", 2},
{true, "SFALL4", "SFALL1", 4}, // Lava fall
{true, "RVZFALL8", "RVZFALL1", 4},
{true, "BFALL4", "BFALL1", 2}, // HPZ waterfall
{true, "GREYW3", "GREYW1", 4},
{true, "BLUEW3", "BLUEW1", 4},
{true, "COMP6", "COMP4", 4},
{true, "RED3", "RED1", 4},
{true, "YEL3", "YEL1", 4},
{true, "ACWRFL1D", "ACWRFL1A", 1},
{true, "ACWRFL2D", "ACWRFL2A", 1},
{true, "ACWRFL3D", "ACWRFL3A", 1},
{true, "ACWRFL4D", "ACWRFL4A", 1},
{true, "ACWRP1D", "ACWRP1A", 1},
{true, "ACWRP2D", "ACWRP2A", 1},
{true, "ACZRP1D", "ACZRP1A", 1},
{true, "ACZRP2D", "ACZRP2A", 1},
{true, "OILFALL4", "OILFALL1", 2},
{true, "SOLFALL4", "SOLFALL1", 2},
{true, "DOWN1C", "DOWN1A", 4},
{true, "DOWN2C", "DOWN2A", 4},
{true, "DOWN3D", "DOWN3A", 4},
{true, "DOWN4C", "DOWN4A", 4},
{true, "DOWN5C", "DOWN5A", 4},
{true, "UP1C", "UP1A", 4},
{true, "UP2C", "UP2A", 4},
{true, "UP3D", "UP3A", 4},
{true, "UP4C", "UP4A", 4},
{true, "UP5C", "UP5A", 4},
{true, "EGRID3", "EGRID1", 4},
{true, "ERFANW4", "ERFANW1", 1},
{true, "ERFANX4", "ERFANX1", 1},
{true, "DISCOD4", "DISCOD1", 15},
{true, "DANCE4", "DANCE1", 8},
{true, "SKY135", "SKY132", 2},
{true, "APPLMS4", "APPLMS1", 2},
{true, "APBOXW3", "APBOXW1", 2},
{true, "ERZLAZC4", "ERZLAZC1", 4},
// End of line
{ -1, "", "", 0},
};
// Animating line specials
// Init animated textures
@@ -208,7 +110,7 @@ void P_ParseAnimationDefintion(SINT8 istexture);
/** Sets up texture and flat animations.
*
* Converts an ::animdef_t array loaded from ::harddefs or a lump into
* Converts an ::animdef_t array loaded from a lump into
* ::anim_t format.
*
* Issues an error if any animation cycles are invalid.
@@ -254,7 +156,9 @@ void P_InitPicAnims(void)
{
memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
animdefs[i].endname[8] = '\0';
memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
animdefs[i].startname[8] = '\0';
memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
}
@@ -275,11 +179,6 @@ void P_InitPicAnims(void)
strncpy(animdefs[maxanims].startname, "", 9);
animdefs[maxanims].speed = 0;
}
else
{
animdefs = harddefs;
for (maxanims = 0; animdefs[maxanims].istexture != -1; maxanims++);
}
if (anims)
free(anims);
@@ -318,10 +217,7 @@ void P_InitPicAnims(void)
animdefs[i].startname, animdefs[i].endname);
}
if (animdefs == harddefs)
lastanim->speed = animdefs[i].speed;
else
lastanim->speed = LONG(animdefs[i].speed);
lastanim->speed = LONG(animdefs[i].speed);
lastanim++;
}
@@ -330,8 +226,7 @@ void P_InitPicAnims(void)
// Clear animdefs now that we're done with it.
// We'll only be using anims from now on.
if (animdefs != harddefs)
Z_Free(animdefs);
Z_Free(animdefs);
animdefs = NULL;
}
+143 -133
View File
@@ -78,7 +78,6 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
mo->momy += FixedMul(move, FINESINE(angle));
}
//
// P_InstaThrust
// Moves the given origin along a given angle instantly.
@@ -239,10 +238,11 @@ void P_GiveEmerald(boolean spawnObj)
if (spawnObj)
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD),
mobjinfo[MT_GOTEMERALD].spawnstate + em);
}
}
}
@@ -352,9 +352,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
player->mo->z++;
if (player->mo->eflags & MFE_UNDERWATER)
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT, 2600*FRACUNIT), false);
else
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT, 10*FRACUNIT), false);
}
ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart
@@ -619,11 +619,11 @@ boolean P_EndingMusic(player_t *player)
// Check for if this is valid or not
if (splitscreen)
{
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
return false;
for (UINT8 i = 0; i <= splitscreen; i++)
{
if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER)))
return false;
}
bestlocalplayer = &players[displayplayers[0]];
bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]]));
@@ -703,71 +703,74 @@ void P_RestoreMusic(player_t *player)
// Event - Level Start
if (leveltime < MUSICSTARTTIME)
S_StartMapMusic();
else // see also where time overs are handled - search for "lives = 2" in this file
{
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
S_StartMapMusic();
return;
}
if (splitscreen)
{
INT32 bestlocaltimer = 1;
// see also where time overs are handled - search for "lives = 2" in this file
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
{
INT32 bestlocaltimer = 1;
#define setbests(p) \
if (players[p].playerstate == PST_LIVE) \
{ \
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
}
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(displayplayers[3]);
if (players[p].playerstate == PST_LIVE) \
{ \
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
}
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(displayplayers[3]);
#undef setbests
}
else
}
else
{
if (player->playerstate == PST_LIVE)
{
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
}
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else
position = mapmusic.position;
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else
position = mapmusic.position;
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0;
}
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0;
}
}
@@ -971,18 +974,7 @@ fixed_t P_GetPlayerHeight(player_t *player)
//
fixed_t P_GetPlayerSpinHeight(player_t *player)
{
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
}
//
// P_GetLocalPlayerForNum
//
// Returns the player
// on the local machine for given number.
//
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
{
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale), 2*FRACUNIT/3);
}
//
@@ -996,6 +988,17 @@ INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
}
//
// P_GetLocalPlayerForNum
//
// Returns the player
// on the local machine for given number.
//
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
{
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
}
INT32 P_GetLocalPlayerNumForPlayer(const player_t *player)
{
for (UINT8 i = 0; i <= splitscreen; i++)
@@ -1022,7 +1025,9 @@ boolean P_IsLocalPlayer(const player_t *player)
for (i = 0; i <= splitscreen; i++)
{
if (player == P_GetLocalPlayerForNum(i))
{
return true;
}
}
return false;
@@ -1041,7 +1046,9 @@ boolean P_IsLocalPlayerNum(UINT8 pnum)
for (i = 0; i <= splitscreen; i++)
{
if (pnum == P_GetLocalPlayerNumForNum(i))
{
return true;
}
}
return false;
@@ -1069,7 +1076,9 @@ boolean P_IsDisplayPlayer(const player_t *player)
}
if (player == &players[displayplayers[i]])
{
return true;
}
}
return false;
@@ -1229,19 +1238,20 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
mobj->flags &= ~MF_DONTENCOREMAP;
// Copy interpolation data :)
ghost->old_x = mobj->old_x2;
ghost->old_y = mobj->old_y2;
ghost->old_z = mobj->old_z2;
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
ghost->old_pitch = mobj->old_pitch2;
ghost->old_roll = mobj->old_roll2;
ghost->old_sloperoll = mobj->old_sloperoll2;
ghost->old_slopepitch = mobj->old_slopepitch2;
ghost->old_scale = mobj->old_scale2;
ghost->old_spritexscale = mobj->old_spritexscale2;
ghost->old_spriteyscale = mobj->old_spriteyscale2;
ghost->old_spritexoffset = mobj->old_spritexoffset2;
ghost->old_spriteyoffset = mobj->old_spriteyoffset2;
// old_x - mobj->momx - hack to preserve vanilla look
ghost->old_x = mobj->old_x - mobj->momx;
ghost->old_y = mobj->old_y - mobj->momy;
ghost->old_z = mobj->old_z2; // Slopes.....
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle);
ghost->old_pitch = mobj->old_pitch;
ghost->old_roll = mobj->old_roll;
ghost->old_sloperoll = mobj->old_sloperoll;
ghost->old_slopepitch = mobj->old_slopepitch;
ghost->old_scale = mobj->old_scale;
ghost->old_spritexscale = mobj->old_spritexscale;
ghost->old_spriteyscale = mobj->old_spriteyscale;
ghost->old_spritexoffset = mobj->old_spritexoffset;
ghost->old_spriteyoffset = mobj->old_spriteyoffset;
return ghost;
}
@@ -1255,7 +1265,9 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting || mapreset)
return;
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
const boolean islocalplayer = P_IsLocalPlayer(player);
if (islocalplayer && (!player->spectator && !demo.playback))
legitimateexit = true;
if (player->griefstrikes > 0)
@@ -1270,7 +1282,7 @@ void P_DoPlayerExit(player_t *player)
{
const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds
if (P_IsLocalPlayer(player))
if (islocalplayer)
{
sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound];
S_StartSound(NULL, sfx_id);
@@ -1324,12 +1336,13 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) > topheight)
continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) < bottomheight)
continue;
@@ -1360,12 +1373,13 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND))
continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
if (mo->z + flipoffset > topheight)
continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) + flipoffset < bottomheight)
continue;
@@ -1547,13 +1561,12 @@ static void P_CheckBouncySectors(player_t *player)
if (top)
{
fixed_t newmom;
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) // Hit top
slope = *rover->t_slope;
} else { // Hit bottom
else // Hit bottom
slope = *rover->b_slope;
}
momentum.x = player->mo->momx;
momentum.y = player->mo->momy;
@@ -1644,7 +1657,8 @@ static void P_CheckQuicksand(player_t *player)
for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_QUICKSAND))
continue;
@@ -1702,10 +1716,8 @@ static void P_CheckInvincibilityTimer(player_t *player)
{
if (!player->powers[pw_super])
{
{
player->mo->color = player->skincolor;
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
}
player->mo->color = player->skincolor;
G_GhostAddColor((INT32)(player - players), GHC_NORMAL);
// If you had a shield, restore its visual significance
P_SpawnShieldOrb(player);
@@ -1730,7 +1742,7 @@ static void P_DoBubbleBreath(player_t *player)
else
zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4));
if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator)
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)))
return;
if (P_RandomChance(FRACUNIT/16))
@@ -1744,9 +1756,6 @@ static void P_DoBubbleBreath(player_t *player)
bubble->destscale = player->mo->scale;
P_SetScale(bubble, bubble->destscale);
}
//if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
//return;
}
//
@@ -1859,10 +1868,10 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
if (!P_CheckSight(player->mo, mo2))
continue; // if your psychic powers can't "see" it don't bother
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
if (mo2->health > 0)
{
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
P_Thrust(mo2, an, thrust);
if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ)
@@ -1912,7 +1921,7 @@ static void P_3dMovement(player_t *player)
if (analogmove)
{
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
movepushangle = (cmd->angleturn << TICCMD_REDUCE);
}
else
{
@@ -2012,12 +2021,17 @@ static void P_3dMovement(player_t *player)
// The rest is unaffected.
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) {
if (player->mo->standingslope->zdelta < 0) // Direction goes down, so thrustangle needs to face toward
{
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270)
{
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
}
} else { // Direction goes up, so thrustangle needs to face away
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) {
}
else // Direction goes up, so thrustangle needs to face away
{
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270)
{
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
}
}
@@ -2072,7 +2086,7 @@ static void P_SpectatorMovement(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */);
player->mo->angle = (angle_t)(cmd->angleturn << TICCMD_REDUCE);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
@@ -2100,10 +2114,6 @@ static void P_SpectatorMovement(player_t *player)
// Quake-style flying spectators :D
player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming));
}
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
{
P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale);
}*/
}
void P_BlackOw(player_t *player)
@@ -2278,7 +2288,7 @@ static void P_MovePlayer(player_t *player)
{
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
angle_diff = cmd->angleturn - (player->mo->angle>>16);
angle_diff = cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE);
max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
@@ -2291,18 +2301,18 @@ static void P_MovePlayer(player_t *player)
else
{
// Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs.
player->mo->angle = cmd->angleturn<<16;
player->mo->angle = cmd->angleturn << TICCMD_REDUCE;
add_delta = false;
}
//CONS_Printf("applied turn: %d\n", angle_diff);
if (add_delta) {
player->mo->angle += angle_diff<<16;
player->mo->angle += angle_diff << TICCMD_REDUCE;
player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
//CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
// player_names[player-players],
// (INT16) (cmd->angleturn - (player->mo->angle>>16)),
// (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1));
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)),
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)) * 100 / (angle_diff ? angle_diff : 1));
}
}
@@ -2732,6 +2742,9 @@ boolean P_LookForEnemies(player_t *player)
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
continue; // not a valid enemy
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (mo->health <= 0) // dead
continue;
@@ -2759,9 +2772,6 @@ boolean P_LookForEnemies(player_t *player)
&& abs(player->mo->y-mo->y) > player->mo->radius))
continue; // not in your 2d plane
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x,
player->mo->y-closestmo->y), player->mo->z-closestmo->z))
@@ -3167,7 +3177,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
lang = cam->localangle;
laim = cam->localaiming;
cmd->angleturn = (INT16)(lang >> 16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->aiming = G_ClipAimingPitch(&laim);
const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle;
@@ -3263,7 +3273,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
axis = JoyAxis(AXISLOOK, forplayer);
laim += (mlooky<<19)*player_invert;
laim += (mousey<<19)*player_invert;
if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0))
{
@@ -3302,7 +3312,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->aiming = G_ClipAimingPitch(&laim);
}
mousex = mousey = mlooky = 0;
mousex = mousey = 0;
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
@@ -3320,7 +3330,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->sidemove = (SINT8)(cmd->sidemove + side);
}
lang += (cmd->angleturn << 16);
lang += (cmd->angleturn << TICCMD_REDUCE);
cam->localangle = lang;
if (!cam->reset_aiming)
@@ -3350,7 +3360,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
cam->aiming = cmd->aiming << FRACBITS;
}
cam->angle = cmd->angleturn << 16;
cam->angle = cmd->angleturn << TICCMD_REDUCE;
// camera movement:
if (!cam->button_a_held)
@@ -3830,7 +3840,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// Sometimes stale ticcmds send a weird angle at the start of the race.
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
if (cv_demoangturn.value && leveltime > starttime)
focusangle = player->cmd.angleturn << 16;
focusangle = player->cmd.angleturn << TICCMD_REDUCE;
else
focusangle = mo->angle; // Just use something known sane.
focusaiming = 0;
+5 -3
View File
@@ -515,13 +515,15 @@ const INT32 checkcoord[12][4] =
static boolean R_CheckBBox(const fixed_t *bspcoord)
{
angle_t angle1, angle2;
INT32 sx1, sx2, boxpos;
INT32 sx1, sx2;
const INT32* check;
// Find the corners of the box
// that define the edges from current viewpoint.
boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5)
return true;
+4 -15
View File
@@ -722,6 +722,10 @@ void R_AddMobjInterpolator(mobj_t *mobj)
interpolated_mobjs.push_back(mobj);
// Maybe not the best place for it, but for first tic this old_z is 0,
// so when R_ResetMobjInterpolationState is called old_z2 will be set to 0
mobj->old_z = mobj->z;
R_ResetMobjInterpolationState(mobj);
mobj->resetinterp = true;
}
@@ -763,22 +767,7 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
if (rendermode == render_none)
return;
mobj->old_x2 = mobj->old_x;
mobj->old_y2 = mobj->old_y;
mobj->old_z2 = mobj->old_z;
mobj->old_angle2 = mobj->old_angle;
mobj->old_scale2 = mobj->old_scale;
// rotation humor
mobj->old_pitch2 = mobj->old_pitch;
mobj->old_roll2 = mobj->old_roll;
mobj->old_slopepitch2 = mobj->old_slopepitch;
mobj->old_sloperoll2 = mobj->old_sloperoll;
mobj->old_spritexscale2 = mobj->old_spritexscale;
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
mobj->old_x = mobj->x;
mobj->old_y = mobj->y;
+9 -5
View File
@@ -567,6 +567,7 @@ static void R_InitTextureMapping(void)
else if (t > viewwidth+1)
t = viewwidth+1;
}
viewangletox[i] = t;
}
@@ -1109,7 +1110,8 @@ static void R_SetupCommonFrame(player_t * player)
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
{
if (player->awayviewtics && player->awayviewmobj)
if (player->awayviewtics && player->awayviewmobj
&& !(thiscam && thiscam->freecam)) // dont force this if we wanna freecam!
{
newview->aim = player->awayviewaiming;
newview->angle = player->awayviewmobj->angle;
@@ -1276,9 +1278,10 @@ void R_SetupFrame(UINT8 pnum, boolean skybox)
R_SetupAimingFrame(player, thiscam);
if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
if (player->awayviewtics && player->awayviewmobj // cut-away view stuff
&& !(thiscam && thiscam->freecam)) // dont force this when we wanna freecam!
{
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN whos altview man?
I_Assert(viewmobj != NULL);
newview->x = viewmobj->x;
@@ -1337,7 +1340,7 @@ static void R_PortalFrame(portal_t *portal)
}
}
static void Mask_Pre (maskcount_t* m)
static void Mask_Pre(maskcount_t* m)
{
m->drawsegs[0] = ds_p - drawsegs;
m->vissprites[0] = visspritecount;
@@ -1347,7 +1350,7 @@ static void Mask_Pre (maskcount_t* m)
m->viewsector = viewsector;
}
static void Mask_Post (maskcount_t* m)
static void Mask_Post(maskcount_t* m)
{
m->drawsegs[1] = ds_p - drawsegs;
m->vissprites[1] = visspritecount;
@@ -1429,6 +1432,7 @@ void R_RenderPlayerView(player_t *player)
// Clear buffers.
R_ClearPlanes();
if (viewmorph.use)
{
portalclipstart = viewmorph.x1;
-5
View File
@@ -1997,16 +1997,11 @@ void I_ShutdownGraphics(void)
graphics_started = false;
I_OutputMsg("shut down\n");
#ifdef HWRENDER
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWR_Shutdown();
if (sdlglcontext)
SDL_GL_DeleteContext(sdlglcontext);
sdlglcontext = NULL;
#endif
if (texture)
SDL_DestroyTexture(texture);
texture = NULL;
+19 -16
View File
@@ -352,7 +352,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
if (pnum == whiteplayer)
{
UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
V_DrawScaledPatch(x+16, y-4, 0, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
STRBUFCPY(strtime, standings->name[i]);
@@ -831,6 +831,9 @@ void Y_VoteScreenCheck(void)
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
VoteScreen.currentAnimFrame = 0;
if (VoteScreen.timePerAnimFrame == 0)
VoteScreen.timePerAnimFrame = 2;
INT32 i = 1;
// check for lua vote background replacements
@@ -856,8 +859,8 @@ void Y_VoteScreenCheck(void)
// non lua vote background handling
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
VoteScreen.widebgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
}
//
@@ -905,7 +908,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
// Draw non animated patch
if (!tempfoundAnimLuaVoteFrames)
{
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
votebg = (patch_t *)W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg);
return;
}
@@ -918,11 +921,11 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
nextframe = (VoteScreen.currentAnimFrame + 1);
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
votebg = (patch_t *)W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg);
if (renderisnewtic && (votetic % 2 == 0) && !paused)
if (renderisnewtic && (votetic % VoteScreen.timePerAnimFrame == 0) && !paused)
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
}
@@ -1186,7 +1189,7 @@ void Y_VoteDrawer(void)
if (!splitscreen && i == consoleplayer)
{
UINT8 cursorframe = (votetic / 4) % 8;
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
}
@@ -1446,14 +1449,14 @@ static void Y_InitVoteDrawing(void)
// setup the background patches
Y_VoteScreenCheck();
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[0] = (patch_t*)W_CachePatchName("M_CURSOR", PU_PATCH);
VoteScreen.cursor[1] = (patch_t*)W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = (patch_t*)W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = (patch_t*)W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = (patch_t*)W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY);
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY);
VoteScreen.randomlvl = (patch_t*)W_CachePatchName("RANDOMLV", PU_PATCH);
VoteScreen.rubyicon = (patch_t*)W_CachePatchName("RUBYICON", PU_PATCH);
}
void Y_StartVote(void)
@@ -1538,9 +1541,9 @@ void Y_StartVote(void)
{
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
if (lumpnum != LUMPERROR)
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY);
levelinfo[i].pic = (patch_t *)W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
else
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY);
levelinfo[i].pic = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH);
}
}
+1
View File
@@ -79,6 +79,7 @@ typedef struct
char luaPrefix[5]; // prefix for lua votescreens
INT32 currentAnimFrame; // current animated background frame
INT32 timePerAnimFrame; // time for 1 frame in ticks, 2 by default
INT32 foundLuaVoteFrames; // normal lua patch frames
INT32 foundLuaVoteWideFrames; // widescreen lua patch frames