Compare commits
125
Commits
sdl3
...
vidmodestuff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
467ecf8224 | ||
|
|
2077315f24 | ||
|
|
67e74b5874 | ||
|
|
9bea6eddbd | ||
|
|
f4e5f7249c | ||
|
|
9639ace28a | ||
|
|
a2616778cc | ||
|
|
495c34dd40 | ||
|
|
b0bf588c27 | ||
|
|
35e4f35f6e | ||
|
|
7866b769cc | ||
|
|
1af1e42dab | ||
|
|
40bd3e5e19 | ||
|
|
25dd3b4976 | ||
|
|
0fe3086a5a | ||
|
|
c9afd4a2cd | ||
|
|
7518a6f181 | ||
|
|
2bf4c44259 | ||
|
|
1c95e5f40e | ||
|
|
7c848f4be5 | ||
|
|
a4af254643 | ||
|
|
860dc37fe4 | ||
|
|
8b3d55fbc8 | ||
|
|
0540b5656a | ||
|
|
6c98440f27 | ||
|
|
3828a9f8e0 | ||
|
|
2c7c9ec32a | ||
|
|
1ccd3e37bc | ||
|
|
6ad344f65d | ||
|
|
1c289d73ca | ||
|
|
44ba69cf53 | ||
|
|
4cea0c1414 | ||
|
|
4ee468f5c6 | ||
|
|
9a58eb3010 | ||
|
|
59ff5e61bf | ||
|
|
821c061f82 | ||
|
|
eb4d9bbdd5 | ||
|
|
c19c80d797 | ||
|
|
a2feaa7fde | ||
|
|
3cb4e86b48 | ||
|
|
ed758fc921 | ||
|
|
a191c8b71e | ||
|
|
3f2e0bd349 | ||
|
|
3bdc745bd1 | ||
|
|
f578781418 | ||
|
|
0bb63ee0af | ||
|
|
2ae9563ab3 | ||
|
|
6b429e4388 | ||
|
|
0321b0d94a | ||
|
|
ac57b7fd2d | ||
|
|
7013e63142 | ||
|
|
4e1ef7c0cd | ||
|
|
892f2253ea | ||
|
|
bebe62346f | ||
|
|
834a94e429 | ||
|
|
fcf833ff48 | ||
|
|
f2a27539d3 | ||
|
|
05d26654df | ||
|
|
cee6a27340 | ||
|
|
66e35a9d67 | ||
|
|
ad096ccd42 | ||
|
|
7a9e81828a | ||
|
|
71e7dacb56 | ||
|
|
f9c0ee865f | ||
|
|
154eaaf027 | ||
|
|
66f5f9b2a2 | ||
|
|
b27275b887 | ||
|
|
c81c2c1d8d | ||
|
|
ccfab57a8c | ||
|
|
56d1343f1b | ||
|
|
b273bc3ca8 | ||
|
|
d4f58a885b | ||
|
|
04458f18f8 | ||
|
|
64152eea0d | ||
|
|
0e0a690e3c | ||
|
|
f283d3ca43 | ||
|
|
982fff959f | ||
|
|
b0e968e3c3 | ||
|
|
e5bbb14ce0 | ||
|
|
327cca2e8e | ||
|
|
e02e9a12d7 | ||
|
|
9e2fd091a8 | ||
|
|
0a04fca634 | ||
|
|
8a3f793324 | ||
|
|
e91892849c | ||
|
|
6b4e3c9d13 | ||
|
|
5f55b81fbf | ||
|
|
ca68bab002 | ||
|
|
339eb1879e | ||
|
|
1adb49c65c | ||
|
|
1d33a05a85 | ||
|
|
cfcd20d44a | ||
|
|
204607e272 | ||
|
|
b89a8ca6f9 | ||
|
|
d4aa352d59 | ||
|
|
c489841732 | ||
|
|
a6a97b4c4f | ||
|
|
fba070f82e | ||
|
|
10c117f95f | ||
|
|
bceda5beb4 | ||
|
|
c50c936b1f | ||
|
|
a05413d925 | ||
|
|
8a8cbffd12 | ||
|
|
1fb6c63097 | ||
|
|
c312380944 | ||
|
|
b5bb2b42bf | ||
|
|
d074f375ca | ||
|
|
6fd14f0a80 | ||
|
|
d6bbb2c1b3 | ||
|
|
fa66b87965 | ||
|
|
c59d5db03e | ||
|
|
b6edc90553 | ||
|
|
23735121ff | ||
|
|
20950b698f | ||
|
|
44df85d6a4 | ||
|
|
42d53f1f6f | ||
|
|
48f2d0ff83 | ||
|
|
517723f9c1 | ||
|
|
6915077e0f | ||
|
|
406dbf333d | ||
|
|
a730dfd212 | ||
|
|
3058d365f3 | ||
|
|
ccc453e0b0 | ||
|
|
c3d02090e4 | ||
|
|
20cd7621c3 |
No files matched your search
+8
-1
@@ -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,3 +1,4 @@
|
||||
/cscope.out
|
||||
*.json
|
||||
*.idx
|
||||
*.gdb_history
|
||||
@@ -64,7 +64,7 @@ endif
|
||||
|
||||
# This must have high to low order.
|
||||
gcc_versions:=\
|
||||
151 150 15\
|
||||
152 151 150 15\
|
||||
142 141 140 14\
|
||||
132 131 130 13\
|
||||
123 122 121 120 12\
|
||||
@@ -77,7 +77,7 @@ gcc_versions:=\
|
||||
55 54 53 52 51 50\
|
||||
49 48 47 46 45 44 43 42 41 40
|
||||
|
||||
latest_gcc_version:=15.1.1
|
||||
latest_gcc_version:=15.2
|
||||
|
||||
# Automatically set version flag, but not if one was
|
||||
# manually set. And don't bother if this is a clean only
|
||||
|
||||
@@ -20,7 +20,7 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
|
||||
CXXFLAGS+= -Wno-aggregate-return
|
||||
|
||||
# -W -Wno-unused
|
||||
WFLAGS:=-Wall -Wno-trigraphs
|
||||
WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference
|
||||
ifndef GCC295
|
||||
#WFLAGS+=-Wno-packed
|
||||
endif
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -226,10 +226,6 @@ const char *I_LocateWad(void)
|
||||
return "/sdcard/srb2";
|
||||
}
|
||||
|
||||
void I_GetJoystickEvents(void){}
|
||||
|
||||
void I_GetJoystick2Events(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
LOGW("I_GetEnv() called?!");
|
||||
|
||||
+11
-11
@@ -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;
|
||||
|
||||
@@ -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) :
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
+7
-4
@@ -237,10 +237,13 @@ void COM_ImmedExecute(const char *ptext)
|
||||
char line[1024] = "";
|
||||
INT32 quotes;
|
||||
|
||||
while (i < strlen(ptext))
|
||||
const size_t txtlength = strlen(ptext);
|
||||
|
||||
while (i < txtlength)
|
||||
{
|
||||
quotes = 0;
|
||||
for (j = 0; i < strlen(ptext); i++,j++)
|
||||
|
||||
for (j = 0; i < txtlength; i++,j++)
|
||||
{
|
||||
if (ptext[i] == '\"' && !quotes && i > 0 && ptext[i-1] != ' ') // Malformed command
|
||||
return;
|
||||
@@ -652,7 +655,7 @@ static void COM_Alias_f(void)
|
||||
CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin);
|
||||
|
||||
int count = 0;
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
|
||||
{
|
||||
if (strncmp(begin, head->name, szBegin) == 0)
|
||||
{
|
||||
@@ -673,7 +676,7 @@ static void COM_Alias_f(void)
|
||||
/* Display alias subtext, show all aliases. */
|
||||
CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n"));
|
||||
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
|
||||
{
|
||||
CONS_Printf(alias_format, head->name, head->value);
|
||||
}
|
||||
|
||||
+12
-4
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
+36
-53
@@ -1457,12 +1457,14 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160);
|
||||
|
||||
memset(tempname, 0, sizeof(tempname));
|
||||
|
||||
// offset filename to just the name only part
|
||||
filename += strlen(filename) - nameonlylength(filename);
|
||||
const size_t filenamelength = strlen(filename);
|
||||
|
||||
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully
|
||||
if (filenamelength > sizeof(tempname)-1) // too long to display fully
|
||||
{
|
||||
size_t endhalfpos = strlen(filename)-10;
|
||||
size_t endhalfpos = filenamelength-10;
|
||||
// display as first 14 chars + ... + last 10 chars
|
||||
// which should add up to 27 if our math(s) is correct
|
||||
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
|
||||
@@ -1775,6 +1777,9 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
static void SV_SendMapIcon(INT32 node)
|
||||
{
|
||||
if (node == 0)
|
||||
return;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
const char *map = va("%sP", G_BuildMapName(gamemap));
|
||||
@@ -2069,6 +2074,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 +2158,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 +2197,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 +2211,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 +2228,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 +2261,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 +2279,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 +2297,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3502,6 +3477,9 @@ void CL_Reset(void)
|
||||
|
||||
memset(player_muted, 0, sizeof(player_muted));
|
||||
|
||||
for (INT32 i = 0; i < MAXPLAYERS; ++i)
|
||||
playerinfo[i].node = 255;
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
@@ -4290,6 +4268,9 @@ void D_ClientServerInit(void)
|
||||
#endif
|
||||
D_LoadBan(false);
|
||||
|
||||
for (INT32 i = 0; i < MAXPLAYERS; ++i)
|
||||
playerinfo[i].node = 255;
|
||||
|
||||
gametic = 0;
|
||||
localgametic = 0;
|
||||
|
||||
@@ -4525,7 +4506,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 +6453,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 +6599,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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
+33
-4
@@ -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);
|
||||
@@ -994,6 +997,8 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_litesteer[i]);
|
||||
|
||||
CV_RegisterVar(&cv_autoaccel[i]);
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
@@ -1003,7 +1008,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 +2652,6 @@ static void Command_Map_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
last_map_cmd = I_GetTime();
|
||||
|
||||
@@ -2830,6 +2834,8 @@ static void Command_Map_f(void)
|
||||
|
||||
fromlevelselect = false;
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
}
|
||||
|
||||
@@ -4720,7 +4726,30 @@ static void Command_ListWADS_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
{
|
||||
|
||||
+12
-7
@@ -1079,12 +1079,14 @@ void CloseNetFile(void)
|
||||
|
||||
// Receiving a file?
|
||||
for (i = 0; i < MAX_WADFILES; i++)
|
||||
{
|
||||
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
|
||||
{
|
||||
fclose(fileneeded[i].file);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove PT_FILEFRAGMENT from acknowledge list
|
||||
Net_AbortPacketType(PT_FILEFRAGMENT);
|
||||
@@ -1098,17 +1100,16 @@ void nameonly(char *s)
|
||||
void *ns;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
ns = &(s[j+1]);
|
||||
len = strlen(ns);
|
||||
#if 0
|
||||
memcpy(s, ns, len+1);
|
||||
#else
|
||||
memmove(s, ns, len+1);
|
||||
#endif
|
||||
memmove(s, ns, len+1);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the length in characters of the last element of a path.
|
||||
@@ -1162,8 +1163,12 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
filestatus_t homecheck; // store result of last file search
|
||||
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
|
||||
|
||||
// skip for startup, our mainwads wont be in there
|
||||
if (loaded_config)
|
||||
// see IdentifyVersion
|
||||
// Iwads skip findfile due to passing fullpath to W_OpenWadFile
|
||||
#if 0
|
||||
// skip for Iwads, as they wont be in there
|
||||
if (!startupiwadcount)
|
||||
#endif
|
||||
{
|
||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
||||
{
|
||||
|
||||
+8
-3
@@ -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
|
||||
|
||||
@@ -167,6 +167,8 @@ static char returnWadPath[256];
|
||||
#include "../i_video.h"
|
||||
#include "../i_sound.h"
|
||||
#include "../i_system.h"
|
||||
#include "../i_time.h"
|
||||
#include "../i_net.h"
|
||||
#include "../screen.h" //vid.WndParent
|
||||
#include "../d_net.h"
|
||||
#include "../g_game.h"
|
||||
@@ -196,8 +198,6 @@ UINT8 keyboard_started = false;
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
// TERMIOS console code from Quake3: thank you!
|
||||
boolean stdin_active = true;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t cursor;
|
||||
@@ -699,11 +699,7 @@ void I_JoyScale4(void)
|
||||
|
||||
|
||||
*/
|
||||
void I_ShutdownJoystick(void)
|
||||
{
|
||||
}
|
||||
|
||||
void I_GetJoystickEvents(UINT8 index)
|
||||
void I_ShutdownJoystick(UINT8 index)
|
||||
{
|
||||
(void)index;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,10 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void VID_RefreshModeList(void)
|
||||
{
|
||||
}
|
||||
|
||||
void VID_PrepareModeList(void)
|
||||
{
|
||||
}
|
||||
@@ -125,6 +129,13 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
|
||||
{
|
||||
(void)width;
|
||||
(void)height;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_StartupGraphics(void)
|
||||
{
|
||||
}
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ 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!
|
||||
|
||||
|
||||
+1
-1
@@ -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
@@ -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
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
|
||||
}
|
||||
|
||||
// case-sensitive of the above
|
||||
FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char *c)
|
||||
{
|
||||
for (; *s && *s == *c; s++, c++) ;
|
||||
return (*s == *c); // make sure both strings ended
|
||||
@@ -18,7 +18,7 @@ FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
|
||||
// length-limited of the above
|
||||
// only true if both strings are at least l characters long AND match, case-sensitively!
|
||||
FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
{
|
||||
for (; *s && *s == *c && --l; s++, c++) ;
|
||||
return !l; // make sure you reached the end
|
||||
|
||||
+155
-86
@@ -55,6 +55,8 @@
|
||||
#include "k_stats.h" // SRB2kart
|
||||
#include "r_fps.h" // frame interpolation/uncapped
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
@@ -246,10 +248,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 +268,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 +283,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 +304,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 +322,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 +334,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 +1136,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 +1166,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 +1185,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 +1227,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 +1236,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 +1412,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 +1432,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 +1626,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]);
|
||||
@@ -2370,49 +2403,69 @@ static long G_GetCreationTime(char *filepath)
|
||||
|
||||
static char *G_GetDemoDate(menudemo_t *pdemo)
|
||||
{
|
||||
char *datetime;
|
||||
datetime = malloc(sizeof(pdemo->date)); // mallocma balls
|
||||
|
||||
// no mallocma balls... :c
|
||||
if (!datetime)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *endPos = NULL;
|
||||
static char datetime[11];
|
||||
time_t file_time = 0;
|
||||
const char *format = NULL;
|
||||
struct tm *tm_buf = NULL;
|
||||
CLEANUP(pfree) char *filename = NULL;
|
||||
|
||||
// get le filepath
|
||||
char *filename;
|
||||
filename = strdup(pdemo->filepath);
|
||||
|
||||
#if defined (_WIN32)
|
||||
if (!filename)
|
||||
{
|
||||
// if we cant get a filename try just getting the file create time
|
||||
#if defined (_WIN32)
|
||||
// if we cant get a filename try just getting the file creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
goto skipfilenametime;
|
||||
}
|
||||
#else
|
||||
if (!filename)
|
||||
{
|
||||
free(datetime);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the actual filename Zzz...
|
||||
nameonly(filename);
|
||||
|
||||
// convert it to long Zzz....
|
||||
file_time = strtol(filename, NULL, 10);
|
||||
free(filename); // dont need this anymore a
|
||||
// the first 10 characters of a replay name usually is a unix timestamp
|
||||
|
||||
// not long enough to contain a valid timestamp
|
||||
if (strlen(filename) < 10)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// try to get file creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
goto skipfilenametime;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef AVOID_ERRNO
|
||||
errno = 0;
|
||||
#endif
|
||||
// get the timestamp as actual numbers lul
|
||||
file_time = strtol(filename, &endPos, 10);
|
||||
|
||||
if (endPos == filename // Empty string
|
||||
#ifndef AVOID_ERRNO
|
||||
|| errno == ERANGE // Number out-of-range
|
||||
#endif
|
||||
|| file_time < 0) // Number is not positive
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// just try and get the creation time then
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (_WIN32)
|
||||
skipfilenametime:
|
||||
#endif
|
||||
|
||||
// then throw it into localtime to get an actual human readable format lmao
|
||||
struct tm *tm_buf = NULL;
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
// cant believe we ended up in 1970
|
||||
@@ -2425,14 +2478,10 @@ skipfilenametime:
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
if (tm_buf == NULL || tm_buf->tm_year <= 110)
|
||||
{
|
||||
free(datetime);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
goto gotcreationtime;
|
||||
#else
|
||||
free(datetime);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
@@ -2441,17 +2490,27 @@ skipfilenametime:
|
||||
gotcreationtime:
|
||||
#endif
|
||||
|
||||
const char *format;
|
||||
|
||||
// US ppl are special (:
|
||||
if (cv_demodateformat.value == 2)
|
||||
format = "%m.%d.%Y";
|
||||
else if (cv_demodateformat.value == 1)
|
||||
format = "%d.%m.%Y";
|
||||
else
|
||||
format = strstr(setlocale(LC_TIME, NULL), "en_US") ? "%m.%d.%Y" : "%d.%m.%Y";
|
||||
{
|
||||
const char *locale = setlocale(LC_TIME, NULL);
|
||||
|
||||
strftime(datetime, sizeof(pdemo->date), format, tm_buf);
|
||||
if (locale == NULL)
|
||||
format = "%d.%m.%Y"; // fallback to non US format
|
||||
else if (strstr(locale, "en_US"))
|
||||
format = "%m.%d.%Y";
|
||||
else
|
||||
format = "%d.%m.%Y";
|
||||
}
|
||||
|
||||
if (strftime(datetime, sizeof(datetime), format, tm_buf) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return datetime;
|
||||
}
|
||||
@@ -2460,6 +2519,7 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
{
|
||||
UINT8 infobuffer[96], *info_p;
|
||||
UINT16 pdemoversion;
|
||||
char *demodate = NULL;
|
||||
size_t count;
|
||||
|
||||
FILE *handle = fopen(pdemo->filepath, "rb");
|
||||
@@ -2498,13 +2558,13 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
memcpy(pdemo->title, info_p, 64);
|
||||
|
||||
// demo date
|
||||
char *demodate;
|
||||
demodate = G_GetDemoDate(pdemo);
|
||||
|
||||
if (demodate)
|
||||
strncpy(pdemo->date, demodate, sizeof(pdemo->date));
|
||||
{
|
||||
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
|
||||
}
|
||||
|
||||
free(demodate);
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
case 0x0001:
|
||||
@@ -2581,7 +2641,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 +2653,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 +2673,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 +2699,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 +2710,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 +2727,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 +2785,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 +2823,16 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
demobuf.p += 4; // Extrainfo location
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR))
|
||||
{
|
||||
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,7 +2860,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);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
@@ -2800,7 +2870,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
{
|
||||
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 +2893,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 +2931,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 +2980,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 +2992,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 +3602,6 @@ void G_FreeGhosts(void)
|
||||
ghosts = NULL;
|
||||
}
|
||||
|
||||
|
||||
boolean G_CheckDemoStatus(void)
|
||||
{
|
||||
G_FreeGhosts();
|
||||
|
||||
@@ -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;
|
||||
|
||||
+90
-22
@@ -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};
|
||||
|
||||
@@ -452,6 +454,14 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
|
||||
{"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
|
||||
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
|
||||
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -662,7 +672,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 +685,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)
|
||||
@@ -798,6 +808,10 @@ static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||
|
||||
//
|
||||
// G_HandleLocalDriftturn
|
||||
// Hack for Lua menus that check directional inputs with driftturn
|
||||
//
|
||||
static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
|
||||
{
|
||||
INT32 axis = 0;
|
||||
@@ -860,9 +874,8 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
|
||||
//
|
||||
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
{
|
||||
boolean moveinput = false;
|
||||
INT32 axis = 0;
|
||||
const boolean usejoystick = (cv_usejoystick[(ssplayer-1)].value);
|
||||
const boolean usejoystick = cv_usejoystick[(ssplayer-1)].value;
|
||||
|
||||
// check for inputs and return button commands
|
||||
// for stuff like joining with item button, saltyhop, honking, etc.
|
||||
@@ -897,15 +910,11 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
|
||||
#undef CHECKINPUT
|
||||
|
||||
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
|
||||
|| InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) ||
|
||||
(usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0));
|
||||
|
||||
axis = JoyAxis(AXISLOOKBACK, ssplayer);
|
||||
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
|
||||
|
||||
// Reset to our spec player if we watch someone else.
|
||||
if ((moveinput || cmd->buttons)
|
||||
if ((cmd->driftturn || cmd->buttons)
|
||||
&& displayplayers[0] != consoleplayer && ssplayer == 1)
|
||||
{
|
||||
if (cv_director.value)
|
||||
@@ -917,6 +926,63 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_HandleAutoAcceleration
|
||||
//
|
||||
static void G_HandleAutoAcceleration(ticcmd_t *cmd, player_t *player, UINT8 forplayer)
|
||||
{
|
||||
if (!cv_autoaccel[forplayer].value)
|
||||
return;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
// dont accel before and during countdown
|
||||
if (leveltime <= starttime)
|
||||
return;
|
||||
|
||||
// dont do this in menus or when console is onscreen
|
||||
if (menuactive || CON_Ready())
|
||||
return;
|
||||
|
||||
// gotta have a player that aint respawning
|
||||
if (!player->mo || player->kartstuff[k_respawn])
|
||||
return;
|
||||
|
||||
// dont need for "finished" players
|
||||
if (player->exiting || (player->pflags & PF_TIMEOVER))
|
||||
return;
|
||||
|
||||
// dont do during spinout
|
||||
if (player->kartstuff[k_spinouttimer])
|
||||
return;
|
||||
|
||||
// spectators and freecam dont need special handling, see G_BuildTiccmd
|
||||
|
||||
if (cmd->buttons & BT_BRAKE)
|
||||
{
|
||||
if (cmd->buttons & BT_DRIFT ||
|
||||
player->kartstuff[k_sneakertimer] ||
|
||||
player->kartstuff[k_squishedtimer])
|
||||
{
|
||||
cmd->forwardmove = (SINT8)forwardmove[0];
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// allows us to drive backwards if we need to
|
||||
if (cmd->forwardmove > 0)
|
||||
cmd->forwardmove = 0;
|
||||
cmd->buttons &= ~BT_ACCELERATE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd->forwardmove = (SINT8)forwardmove[1];
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
@@ -959,7 +1025,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 +1033,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
|
||||
@@ -1064,7 +1130,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
forward = forwardmove[1]; // 50
|
||||
forward = forwardmove[1]; // 50
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
@@ -1127,7 +1193,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;
|
||||
@@ -1145,6 +1211,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
G_HandleAutoAcceleration(cmd, player, forplayer);
|
||||
|
||||
//{ SRB2kart - Drift support
|
||||
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
|
||||
// limit turning to angleturn[1] to stop mouselook letting you look too fast
|
||||
@@ -1166,10 +1234,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 +1818,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 +1840,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 +1864,7 @@ void G_ResetViews(void)
|
||||
*/
|
||||
for (viewd = 1; viewd <= splits; ++viewd)
|
||||
{
|
||||
G_AdjustView(viewd, 0, false);
|
||||
G_AdjustViewEx(viewd, 0, false, resetfreecam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1876,7 +1945,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 +1953,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)
|
||||
|
||||
+6
-3
@@ -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;
|
||||
@@ -74,6 +74,8 @@ extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
@@ -262,9 +264,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
@@ -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
@@ -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];
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -619,7 +619,6 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
// lookup for flats that may´ve been already loaded
|
||||
// too lazy to make a hashtable or smth so unordered set will do :carbuncle:
|
||||
std::unordered_set<UINT32> flatpresent;
|
||||
lumpnum_t lump;
|
||||
size_t i, j;
|
||||
INT32 k;
|
||||
|
||||
@@ -649,9 +648,8 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
||||
|
||||
const levelflat_t *levelflat = &levelflats[pic];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
load_flat(lump, R_NoEncore(sec, ceiling));
|
||||
load_flat(levelflat->lumpnum, R_NoEncore(sec, ceiling));
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
@@ -672,9 +670,8 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
for (i = 0; i < numlevelflats; i++)
|
||||
{
|
||||
const levelflat_t *levelflat = &levelflats[i];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
load_flat(lump, false);
|
||||
load_flat(levelflat->lumpnum, false);
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
|
||||
+224
-186
@@ -14,6 +14,7 @@
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../doomdef.h"
|
||||
@@ -642,8 +643,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 +661,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 +811,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef SETUP3DVERT
|
||||
}
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
@@ -1365,8 +1371,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 +1386,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 +1500,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 +1509,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 +1562,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 +1571,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 +1748,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 +1797,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
|
||||
@@ -1875,6 +1881,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
fixed_t high2, highslope2, low2, lowslope2;
|
||||
|
||||
INT32 texnum;
|
||||
|
||||
@@ -1887,19 +1894,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
for (rover = gl_backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
boolean bothsides = false;
|
||||
// Skip if it exists on both sectors.
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
|
||||
if (rover->master == r2->master)
|
||||
{
|
||||
bothsides = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bothsides)
|
||||
continue;
|
||||
|
||||
const ffloortype_e roverflags = rover->flags;
|
||||
|
||||
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES))
|
||||
@@ -1911,6 +1905,45 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
|
||||
{
|
||||
if (r2->master == rover->master) // Skip if same control line.
|
||||
break;
|
||||
|
||||
const ffloortype_e r2flags = r2->flags;
|
||||
|
||||
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
|
||||
continue;
|
||||
|
||||
if (rover->flags & FF_EXTRA)
|
||||
{
|
||||
if (!(r2flags & FF_CUTEXTRA))
|
||||
continue;
|
||||
|
||||
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(r2flags & FF_CUTSOLIDS))
|
||||
continue;
|
||||
}
|
||||
|
||||
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||
|
||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||
continue;
|
||||
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (r2)
|
||||
continue;
|
||||
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
@@ -1977,24 +2010,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2047,19 +2080,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
boolean bothsides = false;
|
||||
// Skip if it exists on both sectors.
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
|
||||
if (rover->master == r2->master)
|
||||
{
|
||||
bothsides = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bothsides)
|
||||
continue;
|
||||
|
||||
const ffloortype_e roverflags = rover->flags;
|
||||
|
||||
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
|
||||
@@ -2071,6 +2091,44 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
|
||||
{
|
||||
if (r2->master == rover->master) // Skip if same control line.
|
||||
break;
|
||||
|
||||
const ffloortype_e r2flags = r2->flags;
|
||||
|
||||
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
|
||||
continue;
|
||||
|
||||
if (rover->flags & FF_EXTRA)
|
||||
{
|
||||
if (!(r2flags & FF_CUTEXTRA))
|
||||
continue;
|
||||
|
||||
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(r2flags & FF_CUTSOLIDS))
|
||||
continue;
|
||||
}
|
||||
|
||||
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||
|
||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||
continue;
|
||||
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
if (r2)
|
||||
continue;
|
||||
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
@@ -2137,24 +2195,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 +2553,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 +2676,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 +2698,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 +2748,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 +3499,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 +3513,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
|
||||
@@ -4185,6 +4227,7 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
static void HWR_SortVisSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
{
|
||||
gl_vsprorder[i] = HWR_GetVisSprite(i);
|
||||
@@ -4253,38 +4296,29 @@ typedef struct
|
||||
|
||||
// initial size of drawnode array
|
||||
#define DRAWNODES_INIT_SIZE 64
|
||||
gl_drawnode_t *drawnodes = NULL;
|
||||
INT32 numdrawnodes = 0;
|
||||
INT32 alloceddrawnodes = 0;
|
||||
// no reason to waste all the allocations since every map will have atleast one translucent thing
|
||||
static std::vector<gl_drawnode_t> drawnodes;
|
||||
|
||||
static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
|
||||
{
|
||||
gl_drawnode_t *drawnode;
|
||||
// if we didnt alloc anything yet, reserve atleast 64 nodes
|
||||
// dont declare with it as we want our size to be 0!
|
||||
drawnodes.reserve(DRAWNODES_INIT_SIZE);
|
||||
|
||||
if (!drawnodes)
|
||||
{
|
||||
alloceddrawnodes = DRAWNODES_INIT_SIZE;
|
||||
drawnodes = static_cast<gl_drawnode_t*>(Z_Malloc(alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes));
|
||||
}
|
||||
else if (numdrawnodes >= alloceddrawnodes)
|
||||
{
|
||||
alloceddrawnodes *= 2;
|
||||
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
|
||||
}
|
||||
|
||||
drawnode = &drawnodes[numdrawnodes++];
|
||||
drawnode->type = type;
|
||||
drawnodes.emplace_back();
|
||||
drawnodes.back().type = type;
|
||||
|
||||
// not sure if returning different pointers to a union is necessary
|
||||
switch (type)
|
||||
{
|
||||
case DRAWNODE_PLANE:
|
||||
return &drawnode->u.plane;
|
||||
return &drawnodes.back().u.plane;
|
||||
case DRAWNODE_POLYOBJECT_PLANE:
|
||||
return &drawnode->u.polyplane;
|
||||
return &drawnodes.back().u.polyplane;
|
||||
case DRAWNODE_WALL:
|
||||
return &drawnode->u.wall;
|
||||
return &drawnodes.back().u.wall;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4348,11 +4382,15 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
||||
// Sorts and renders the list of drawnodes for the scene being rendered.
|
||||
static void HWR_RenderDrawNodes(void)
|
||||
{
|
||||
INT32 i = 0, run_start = 0;
|
||||
size_t i = 0, run_start = 0;
|
||||
static std::vector<INT32> sortindex;
|
||||
|
||||
sortindex.reserve(DRAWNODES_INIT_SIZE);
|
||||
|
||||
// Array for storing the rendering order.
|
||||
// A list of indices into the drawnodes array.
|
||||
INT32 *sortindex;
|
||||
|
||||
const size_t numdrawnodes = drawnodes.size();
|
||||
|
||||
if (!numdrawnodes)
|
||||
return;
|
||||
@@ -4361,7 +4399,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_START_TIMING(ps_hw_nodesorttime);
|
||||
|
||||
sortindex = static_cast<INT32*>(Z_Malloc(sizeof(INT32) * numdrawnodes, PU_STATIC, NULL));
|
||||
sortindex.resize(numdrawnodes);
|
||||
|
||||
// Reversed order
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
@@ -4377,7 +4415,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE)
|
||||
{
|
||||
// found it, now look for run end
|
||||
INT32 run_end; // (inclusive)
|
||||
size_t run_end; // (inclusive)
|
||||
|
||||
for (i = run_start+1; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -4390,7 +4428,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (run_end > run_start) // if there are multiple consecutive planes, not just one
|
||||
{
|
||||
// consecutive run of planes found, now sort it
|
||||
qs22j(sortindex + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
qs22j(sortindex.data() + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
}
|
||||
|
||||
run_start = run_end + 1; // continue looking for runs coming right after this one
|
||||
@@ -4462,9 +4500,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_STOP_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
numdrawnodes = 0;
|
||||
|
||||
Z_Free(sortindex);
|
||||
drawnodes.clear(); // clear so our size is 0 again!
|
||||
}
|
||||
|
||||
|
||||
@@ -5152,6 +5188,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 +5368,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 +5386,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 +5431,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 +5443,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 +5462,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 +5477,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
|
||||
@@ -5500,7 +5538,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
player_t *viewplayer = &players[displayplayers[viewssnum]];
|
||||
const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer));
|
||||
|
||||
auto reset_viewstate = [&](const float fpov)
|
||||
auto reset_viewstate = [&]()
|
||||
{
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearSprites();
|
||||
@@ -5520,7 +5558,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
currentportallist = &portallist;
|
||||
HWR_SetPortalState(GLPORTAL_SEARCH);
|
||||
|
||||
reset_viewstate(fpov);
|
||||
reset_viewstate();
|
||||
|
||||
if (rootportal)
|
||||
{
|
||||
@@ -5546,7 +5584,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
|
||||
reset_viewstate(fpov);
|
||||
reset_viewstate();
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
@@ -5701,7 +5739,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 +6139,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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+25
-18
@@ -596,12 +596,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
}
|
||||
|
||||
// Only servers/admins can CSAY.
|
||||
if(!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
if (!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
flags &= ~HU_CSAY;
|
||||
|
||||
// We handle HU_SERVER_SAY, not the caller.
|
||||
flags &= ~HU_SERVER_SAY;
|
||||
if(dedicated && !(flags & HU_CSAY))
|
||||
if (dedicated && !(flags & HU_CSAY))
|
||||
flags |= HU_SERVER_SAY;
|
||||
|
||||
buf[0] = target;
|
||||
@@ -615,17 +615,20 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
strlcat(msg, COM_Argv(ix + usedargs), msgspace);
|
||||
}
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
CLEANUP(pfree) char *nodenum = (char*) malloc(3);
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
@@ -634,23 +637,21 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
@@ -661,12 +662,13 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = target;
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
|
||||
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
|
||||
SendNetXCmd(XD_SAY, buf, msglength + 1 + msg-buf);
|
||||
}
|
||||
|
||||
/** Send a message to everyone.
|
||||
@@ -917,10 +919,12 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
//check for invalid characters (0x80 or above)
|
||||
{
|
||||
size_t i;
|
||||
const size_t j = strlen(msg);
|
||||
const size_t j = msglength;
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (msg[i] & 0x80)
|
||||
@@ -967,7 +971,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
}
|
||||
|
||||
// Handle "/me" actions, but only in messages to everyone.
|
||||
if (target == 0 && strlen(msg) > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
if (target == 0 && msglength > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
{
|
||||
msg += 4;
|
||||
action = true;
|
||||
@@ -1149,10 +1153,12 @@ static boolean HU_clearChatSpaces(void)
|
||||
size_t i = 0; // Used to just check our message
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
const size_t chatlength = strlen(w_chat_buf);
|
||||
|
||||
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
for (; i < chatlength; i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat_buf[i];
|
||||
|
||||
if (!c)
|
||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
||||
|
||||
@@ -1161,6 +1167,7 @@ static boolean HU_clearChatSpaces(void)
|
||||
nothingbutspaces = false;
|
||||
}
|
||||
}
|
||||
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
@@ -1207,11 +1214,11 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t len = strlen(msg);
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
if (msglength >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
{
|
||||
if (len > 6)
|
||||
if (msglength > 6)
|
||||
DoMute(msg+6);
|
||||
else
|
||||
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
|
||||
@@ -1219,7 +1226,7 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
const char *newmsg;
|
||||
@@ -1731,7 +1738,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;
|
||||
@@ -1991,7 +1998,7 @@ static void HU_DrawChat(void)
|
||||
longest_name_length = max(longest_name_length, strlen(player_names[i]));
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXPLAYERS; i++)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
@@ -29,6 +29,10 @@ extern "C" {
|
||||
*/
|
||||
#define MAX_QUIT_FUNCS 16
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
extern boolean consolevent;
|
||||
extern boolean framebuffer;
|
||||
|
||||
/** \brief Graphic system had started up
|
||||
*/
|
||||
|
||||
+6
-5
@@ -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++)
|
||||
|
||||
+11
-2
@@ -95,6 +95,7 @@ INT32 VID_SetMode(INT32 modenum);
|
||||
*/
|
||||
const char *VID_GetModeName(INT32 modenum);
|
||||
|
||||
void VID_RefreshModeList(void);
|
||||
void VID_PrepareModeList(void);
|
||||
|
||||
/** \brief can video system do fullscreen
|
||||
@@ -121,12 +122,11 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
|
||||
|
||||
UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
void I_SetBorderlessWindow(void);
|
||||
|
||||
void I_HandleControllerHatRepeat(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
@@ -135,6 +135,15 @@ boolean UseScreenFBO(void);
|
||||
extern boolean downsample;
|
||||
#endif
|
||||
|
||||
// So we can call this from i_video event loop
|
||||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
|
||||
|
||||
void I_HandleControllerHatRepeat(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
|
||||
// For great modding!!
|
||||
|
||||
|
||||
+4
-2
@@ -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;
|
||||
@@ -4468,7 +4468,9 @@ static void K_drawLapStartAnim(void)
|
||||
V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL);
|
||||
|
||||
char *lapnum = va("%02d", stplyr->laps + 1);
|
||||
for (int i = 0; i < (int)strlen(lapnum); i++)
|
||||
const size_t laplength = strlen(lapnum);
|
||||
|
||||
for (int i = 0; i < (int)laplength; i++)
|
||||
{
|
||||
int digit = lapnum[i] - '0';
|
||||
int frame = min(2, progress/2 - 8 - (i*2));
|
||||
|
||||
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
+20
-17
@@ -1064,9 +1064,13 @@ static void ArchiveTables(UINT8 **p)
|
||||
{
|
||||
// Write key
|
||||
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
||||
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||
if (e == 1)
|
||||
n++; // the table contained a new table we'll have to archive. :(
|
||||
else if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i);
|
||||
lua_pop(gL, 1);
|
||||
continue;
|
||||
}
|
||||
else if (e == 3) // nil key due to invalid userdata. NOT an error.
|
||||
{
|
||||
@@ -1077,15 +1081,12 @@ static void ArchiveTables(UINT8 **p)
|
||||
// Write value
|
||||
e = ArchiveValue(p, TABLESINDEX, -1);
|
||||
if (e == 1)
|
||||
{
|
||||
n++; // the table contained a new table we'll have to archive. :(
|
||||
}
|
||||
else if (e == 2) // invalid value type
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1));
|
||||
}
|
||||
|
||||
lua_pop(gL, 1);
|
||||
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
WRITEUINT8(*p, ARCH_TEND);
|
||||
@@ -1276,13 +1277,21 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
UINT8 ret;
|
||||
|
||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||
if (ret == 3)
|
||||
if (ret == 1) // End of table
|
||||
break;
|
||||
else if (ret == 2) // Key contains a new table
|
||||
n++;
|
||||
else if (ret == 3)
|
||||
{
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 1) // read key
|
||||
break;
|
||||
|
||||
if (lua_isnil(gL, -1)) // If key is nil, skip this entry
|
||||
{
|
||||
lua_pop(gL, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||
if (ret == 1)
|
||||
@@ -1291,21 +1300,15 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
lua_pop(gL, 1); // Pop key
|
||||
break;
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
n++;
|
||||
else if (ret == 3)
|
||||
{
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
n++;
|
||||
|
||||
if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "A nil key in table %d was found! (Invalid key type or corrupted save?)\n", i);
|
||||
lua_pop(gL, 2); // pop key and value instead of setting them in the table, to prevent Lua panic errors
|
||||
}
|
||||
else
|
||||
lua_rawset(gL, -3);
|
||||
lua_rawset(gL, -3);
|
||||
}
|
||||
|
||||
lua_pop(gL, 1);
|
||||
|
||||
+6
-4
@@ -49,17 +49,19 @@ aatree_t *M_AATreeAlloc(UINT32 flags)
|
||||
return aatree;
|
||||
}
|
||||
|
||||
static void M_AATreeFree_Node(aatree_node_t *node)
|
||||
static void M_AATreeFree_Node(aatree_node_t *node, bool is_string)
|
||||
{
|
||||
if (node->left) M_AATreeFree_Node(node->left);
|
||||
if (node->right) M_AATreeFree_Node(node->right);
|
||||
if (node->left) M_AATreeFree_Node(node->left, is_string);
|
||||
if (node->right) M_AATreeFree_Node(node->right, is_string);
|
||||
if (is_string)
|
||||
Z_Free(node->value);
|
||||
Z_Free(node);
|
||||
}
|
||||
|
||||
void M_AATreeFree(aatree_t *aatree)
|
||||
{
|
||||
if (aatree->root)
|
||||
M_AATreeFree_Node(aatree->root);
|
||||
M_AATreeFree_Node(aatree->root, (aatree->flags & AATREE_STRING) == AATREE_STRING);
|
||||
|
||||
Z_Free(aatree);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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))
|
||||
|
||||
+377
-282
File diff suppressed because it is too large.
Load diff
+10
-2
@@ -223,6 +223,11 @@ extern menu_t *currentMenu;
|
||||
extern menu_t MainDef;
|
||||
extern menu_t SP_LoadDef;
|
||||
|
||||
#define MAXCOLUMNMODES 12 //max modes displayed in one column
|
||||
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
|
||||
extern menu_t OP_VideoModeDef;
|
||||
void M_VideoModeMenu(INT32 choice);
|
||||
|
||||
// Call upon joystick hotplug
|
||||
void M_SetupJoystickMenu(INT32 choice);
|
||||
extern menu_t OP_JoystickSetDef;
|
||||
@@ -301,12 +306,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);
|
||||
@@ -395,7 +403,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CONTROLMENUSTYLE(source, prev)\
|
||||
#define CONTROLMENUSTYLE(source, prev, tooltip)\
|
||||
{\
|
||||
"M_CONTRO",\
|
||||
sizeof (source)/sizeof (menuitem_t),\
|
||||
@@ -406,7 +414,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
26, 40,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
#define IMAGEDEF(source)\
|
||||
|
||||
+84
-69
@@ -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},
|
||||
@@ -648,17 +648,6 @@ static menuitem_t OP_ControlsMenu[] =
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P1)", &cv_turnsmooth[0], 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P2)", &cv_turnsmooth[1], 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P3)", &cv_turnsmooth[2], 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P4)", &cv_turnsmooth[3], 115},
|
||||
|
||||
// i hate our menus sincerly
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P1)", &cv_litesteer[0], 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P2)", &cv_litesteer[1], 145},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P3)", &cv_litesteer[2], 155},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P4)", &cv_litesteer[3], 165},
|
||||
};
|
||||
|
||||
static const char* OP_ControlsTooltips[] =
|
||||
@@ -669,15 +658,6 @@ static const char* OP_ControlsTooltips[] =
|
||||
"Setup player 4 controls.",
|
||||
"Options for mouse control.",
|
||||
"Allowed amount of controls per key.",
|
||||
"Turn smoothing for non-analog turning (Player 1).",
|
||||
"Turn smoothing for non-analog turning (Player 2).",
|
||||
"Turn smoothing for non-analog turning (Player 3).",
|
||||
"Turn smoothing for non-analog turning (Player 4).",
|
||||
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 1).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 2).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 3).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 4).",
|
||||
};
|
||||
|
||||
static menuitem_t OP_AllControlsMenu[] =
|
||||
@@ -685,6 +665,13 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
|
||||
{IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
|
||||
|
||||
{IT_HEADER, NULL, "Control Options", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
|
||||
// Cvars are set in M_SetupControlsMenu
|
||||
{IT_STRING|IT_CVAR, NULL, "Lite Steer", &cv_litesteer[0], 18},
|
||||
{IT_STRING|IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth[0], 26},
|
||||
|
||||
//{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
@@ -733,6 +720,17 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 },
|
||||
};
|
||||
|
||||
// Has to be same length as OP_AllControlsMenu, but otherwise its mostly empty
|
||||
static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_AllControlsMenu[0])] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns.",
|
||||
"Turn smoothing for non-analog turning.",
|
||||
// The rest is null, for now
|
||||
};
|
||||
|
||||
#define OP_JOYMENU(pnum) \
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \
|
||||
@@ -800,7 +798,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 +1323,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[] =
|
||||
@@ -1340,16 +1339,19 @@ static menuitem_t OP_CamOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 50},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 60},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 70},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam Mode", &cv_flipcammode, 40},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 60},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 70},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 80},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 90},
|
||||
};
|
||||
|
||||
static const char* OP_CamOptionsTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Player field of view.",
|
||||
"Change flipcam mode.\nDisplayplayer - use currently viewed player option.\nLocal - use local flipcam toggle option.",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1645,12 +1647,19 @@ 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},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
|
||||
|
||||
{IT_HEADER, NULL, "Controls", NULL, 100},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
|
||||
};
|
||||
|
||||
static const char* OP_AccessibilityTooltips[] =
|
||||
@@ -1672,6 +1681,11 @@ static const char* OP_AccessibilityTooltips[] =
|
||||
NULL,
|
||||
"Reverse left and right channels of audio.",
|
||||
"Change how often the same Sound is allowed to play at once.",
|
||||
NULL,
|
||||
"Automatically hold acceleration button (Player 1).",
|
||||
"Automatically hold acceleration button (Player 2).",
|
||||
"Automatically hold acceleration button (Player 3).",
|
||||
"Automatically hold acceleration button (Player 4).",
|
||||
};
|
||||
|
||||
static menuitem_t OP_SaturnMenu[] =
|
||||
@@ -1848,15 +1862,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 +1898,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 +1986,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[] =
|
||||
@@ -2478,7 +2493,7 @@ menu_t OP_MainDef =
|
||||
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
|
||||
//WTF
|
||||
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef, OP_AllControlsTooltips);
|
||||
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
@@ -2617,7 +2632,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);
|
||||
|
||||
+12
-10
@@ -1346,14 +1346,15 @@ void M_MinimapGenerate(void)
|
||||
minigen = AM_MinimapGenerate(mul);
|
||||
|
||||
if (minigen == NULL || minigen->buf == NULL)
|
||||
goto failure;
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
M_CreateScreenShotPalette();
|
||||
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
|
||||
|
||||
failure:
|
||||
if (minigen->buf != NULL)
|
||||
free(minigen->buf);
|
||||
free(minigen->buf);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
@@ -1693,22 +1694,23 @@ char *M_GetToken(const char *inputString)
|
||||
}
|
||||
|
||||
|
||||
const char * M_Ftrim (double f)
|
||||
const char * M_Ftrim(double f)
|
||||
{
|
||||
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
|
||||
int i;
|
||||
|
||||
/* I know I said it's the default, but just in case... */
|
||||
sprintf(dig, "%.6f", fabs(modf(f, &f)));
|
||||
|
||||
/* trim trailing zeroes */
|
||||
for (i = strlen(dig)-1; dig[i] == '0'; --i)
|
||||
;
|
||||
|
||||
if (dig[i] == '.')/* :NOTHING: */
|
||||
return "";
|
||||
else
|
||||
{
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
}
|
||||
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
}
|
||||
|
||||
/** Count bits in a number.
|
||||
|
||||
+1
-2
@@ -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;
|
||||
|
||||
|
||||
@@ -272,6 +272,9 @@ extern consvar_t cv_gravity;
|
||||
|
||||
void P_RespawnSpecials(void);
|
||||
|
||||
extern mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1];
|
||||
void CalculateDoomednumToMobjtype(void);
|
||||
|
||||
mobj_t *P_AllocateMobj(void);
|
||||
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
|
||||
|
||||
|
||||
+60
-35
@@ -3237,7 +3237,22 @@ void P_DestroyRobots(void)
|
||||
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
|
||||
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
boolean player_flipcam = false;
|
||||
|
||||
if (cv_flipcammode.value == 0)
|
||||
player_flipcam = player->pflags & PF_FLIPCAM;
|
||||
else
|
||||
{
|
||||
INT32 pnum = P_GetLocalPlayerNumForPlayer(player);
|
||||
|
||||
// Shouldn't happen but just in case
|
||||
if (pnum == -1)
|
||||
pnum = 0;
|
||||
|
||||
player_flipcam = cv_flipcam[pnum].value;
|
||||
}
|
||||
|
||||
const boolean flipcam = (player_flipcam && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
UINT8 postimgtype = 0;
|
||||
|
||||
if (encoremode)
|
||||
@@ -10448,6 +10463,24 @@ void P_PrecipitationEffects(void)
|
||||
}
|
||||
}
|
||||
|
||||
mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1] = {};
|
||||
|
||||
void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
const INT32 doomednum = mobjinfo[i].doomednum;
|
||||
|
||||
if (doomednum > 0 && doomednum <= MAXDOOMEDNUM)
|
||||
{
|
||||
if (g_doomednum_to_mobjtype[doomednum] == MT_NULL)
|
||||
g_doomednum_to_mobjtype[doomednum] = (mobjtype_t)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_RespawnSpecials
|
||||
//
|
||||
@@ -10521,17 +10554,15 @@ void P_RespawnSpecials(void)
|
||||
|
||||
if (mthing)
|
||||
{
|
||||
mobjtype_t i;
|
||||
mobjtype_t i = MT_NULL;
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
ss = R_PointInSubsector(x, y);
|
||||
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
{
|
||||
// 3D Mode start Thing is unlikely to be added to the que,
|
||||
// so don't bother checking for that specific type
|
||||
@@ -10959,7 +10990,7 @@ INT32 numhuntemeralds = 0;
|
||||
//
|
||||
void P_SpawnMapThing(mapthing_t *mthing)
|
||||
{
|
||||
mobjtype_t i;
|
||||
mobjtype_t i = MT_NULL;
|
||||
mobj_t *mobj;
|
||||
fixed_t x, y, z;
|
||||
subsector_t *ss;
|
||||
@@ -10972,11 +11003,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if (objectplacing)
|
||||
{
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES)
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11044,13 +11073,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
}
|
||||
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
}
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES)
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11743,32 +11768,32 @@ ML_NOCLIMB : Direction not controllable
|
||||
if (mobj->flags & MF_MONITOR)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
else if (mthing->type != mobjinfo[MT_AXIS].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum &&
|
||||
mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_STARPOST].doomednum)
|
||||
else if (
|
||||
i != MT_AXIS &&
|
||||
i != MT_AXISTRANSFER &&
|
||||
i != MT_AXISTRANSFERLINE &&
|
||||
i != MT_NIGHTSBUMPER &&
|
||||
i != MT_STARPOST)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
mobj->flags2 |= MF2_STRONGBOX;
|
||||
|
||||
// Requires you to be in bonus time to activate
|
||||
|
||||
+1
-6
@@ -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;
|
||||
|
||||
|
||||
+1
-2
@@ -1385,8 +1385,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta,
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
angle_t localangle = P_GetLocalAngle(mo->player);
|
||||
P_ForceLocalAngle(mo->player, localangle + delta);
|
||||
P_ForceLocalAngle(mo->player, P_GetLocalAngle(mo->player) + delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1965,21 +1965,6 @@ FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
|
||||
// Loads a mobj_t from a save game
|
||||
//
|
||||
|
||||
static mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
|
||||
|
||||
static void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
|
||||
{
|
||||
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
{
|
||||
mobj_t *mobj;
|
||||
@@ -2879,10 +2864,6 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||
if (READUINT32(save->p) != ARCHIVEBLOCK_THINKERS)
|
||||
I_Error("Bad $$$.sav at archive block Thinkers");
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
// remove all the current thinkers
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = next)
|
||||
{
|
||||
|
||||
+8
-4
@@ -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);
|
||||
@@ -2861,6 +2861,10 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
|
||||
P_ResetDynamicSlopes();
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
P_SpawnMapThings();
|
||||
|
||||
P_SpawnEmblems(!fromnetsave);
|
||||
|
||||
+6
-111
@@ -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
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
+14
-5
@@ -182,6 +182,9 @@ consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t flipcammode_cons_t[] = {{0, "Displayplayer"}, {1, "Local"}, {0, NULL}};
|
||||
consvar_t cv_flipcammode = {"flipcammode", "Displayplayer", CV_SAVE, flipcammode_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -567,6 +570,7 @@ static void R_InitTextureMapping(void)
|
||||
else if (t > viewwidth+1)
|
||||
t = viewwidth+1;
|
||||
}
|
||||
|
||||
viewangletox[i] = t;
|
||||
}
|
||||
|
||||
@@ -1109,7 +1113,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 +1281,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 +1343,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 +1353,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 +1435,7 @@ void R_RenderPlayerView(player_t *player)
|
||||
|
||||
// Clear buffers.
|
||||
R_ClearPlanes();
|
||||
|
||||
if (viewmorph.use)
|
||||
{
|
||||
portalclipstart = viewmorph.x1;
|
||||
@@ -1542,6 +1549,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_flipcam[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_flipcammode);
|
||||
|
||||
// Enough for dedicated server
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
@@ -205,6 +205,7 @@ extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
|
||||
extern consvar_t cv_homremoval;
|
||||
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcammode;
|
||||
extern consvar_t cv_shadow, cv_shadowoffs;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
extern consvar_t cv_softcyancut;
|
||||
|
||||
+5
-5
@@ -2229,12 +2229,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz;
|
||||
highcutslope = std::min(worldtopslope, worldhighslope) + viewz;
|
||||
|
||||
auto check_fof_offscreen = [&](ffloor_t* rover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
||||
auto check_fof_offscreen = [&](ffloor_t* rrover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
||||
{
|
||||
return ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= bottom + viewz
|
||||
&& P_GetFFloorTopZAt (rover, segright.x, segright.y) <= bottomslope + viewz)
|
||||
|| ( P_GetFFloorBottomZAt (rover, segleft .x, segleft .y) >= top + viewz
|
||||
&& P_GetFFloorBottomZAt (rover, segright.x, segright.y) >= topslope + viewz));
|
||||
return ((P_GetFFloorTopZAt (rrover, segleft .x, segleft .y) <= bottom + viewz
|
||||
&& P_GetFFloorTopZAt (rrover, segright.x, segright.y) <= bottomslope + viewz)
|
||||
|| ( P_GetFFloorBottomZAt (rrover, segleft .x, segleft .y) >= top + viewz
|
||||
&& P_GetFFloorBottomZAt (rrover, segright.x, segright.y) >= topslope + viewz));
|
||||
};
|
||||
|
||||
if (frontsector->ffloors && backsector->ffloors)
|
||||
|
||||
+1
-1
@@ -1577,7 +1577,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
else
|
||||
blendmode = thing->blendmode;
|
||||
|
||||
if (thing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK
|
||||
else if (thing->frame & FF_TRANSMASK)
|
||||
{
|
||||
|
||||
@@ -1491,6 +1491,9 @@ musicdef_t *S_FindMusicCredit(const char *musname)
|
||||
{
|
||||
def = S_GetMusicCredit(i);
|
||||
|
||||
if (!def)
|
||||
continue;
|
||||
|
||||
if (hash != def->hash)
|
||||
continue;
|
||||
|
||||
|
||||
+5
-4
@@ -42,8 +42,8 @@ INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to
|
||||
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
|
||||
|
||||
//added : 03-02-98: default screen mode, as loaded/saved in config
|
||||
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -315,8 +315,9 @@ void SCR_CheckDefaultMode(void)
|
||||
void SCR_SetDefaultMode(void)
|
||||
{
|
||||
// remember the default screen size
|
||||
CV_SetValue(&cv_scr_width, vid.width);
|
||||
CV_SetValue(&cv_scr_height, vid.height);
|
||||
CV_StealthSetValue(&cv_scr_width, vid.width);
|
||||
CV_StealthSetValue(&cv_scr_height, vid.height);
|
||||
VID_RefreshModeList(); // probably not needed but justin käs
|
||||
}
|
||||
|
||||
// Change fullscreen on/off according to cv_fullscreen
|
||||
|
||||
+23
-17
@@ -213,14 +213,12 @@ static char returnWadPath[256];
|
||||
#include "../byteptr.h"
|
||||
#endif
|
||||
|
||||
SDL_bool consolevent = SDL_FALSE;
|
||||
SDL_bool framebuffer = SDL_FALSE;
|
||||
boolean consolevent = false;
|
||||
boolean framebuffer = false;
|
||||
UINT8 keyboard_started = false;
|
||||
|
||||
#ifdef HAVE_TERMIOS
|
||||
// TERMIOS console code from Quake3: thank you!
|
||||
SDL_bool stdin_active = SDL_TRUE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t cursor;
|
||||
@@ -282,7 +280,7 @@ static void I_ShutdownConsole(void)
|
||||
if (consolevent)
|
||||
{
|
||||
I_OutputMsg("Shutdown tty console\n");
|
||||
consolevent = SDL_FALSE;
|
||||
consolevent = false;
|
||||
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
|
||||
}
|
||||
}
|
||||
@@ -301,7 +299,7 @@ static void I_StartupConsole(void)
|
||||
framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer"));
|
||||
|
||||
if (framebuffer)
|
||||
consolevent = SDL_FALSE;
|
||||
consolevent = false;
|
||||
|
||||
if (!consolevent)
|
||||
return;
|
||||
@@ -309,7 +307,7 @@ static void I_StartupConsole(void)
|
||||
if (isatty(STDIN_FILENO)!=1)
|
||||
{
|
||||
I_OutputMsg("stdin is not a tty, tty console mode failed\n");
|
||||
consolevent = SDL_FALSE;
|
||||
consolevent = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -511,7 +509,7 @@ static void I_StartupConsole(void)
|
||||
if (gotConsole)
|
||||
{
|
||||
SetConsoleTitleA("SRB2Kart Console");
|
||||
consolevent = SDL_TRUE;
|
||||
consolevent = true;
|
||||
}
|
||||
|
||||
//Let get the real console HANDLE, because Mingw's Bash is bad!
|
||||
@@ -544,7 +542,7 @@ static inline void I_StartupConsole(void)
|
||||
framebuffer = M_CheckParm("-framebuffer");
|
||||
|
||||
if (framebuffer)
|
||||
consolevent = SDL_FALSE;
|
||||
consolevent = false;
|
||||
}
|
||||
static inline void I_ShutdownConsole(void){}
|
||||
#endif
|
||||
@@ -765,7 +763,7 @@ void I_JoyScale4(void)
|
||||
}
|
||||
|
||||
// Cheat to get the device index for a joystick handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
|
||||
static INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
|
||||
{
|
||||
SDL_Joystick *joystick = NULL;
|
||||
|
||||
@@ -1851,17 +1849,20 @@ INT32 I_StartupSystem(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean is_quitting = false;
|
||||
|
||||
//
|
||||
// I_Quit
|
||||
//
|
||||
FUNCNORETURN void ATTRNORETURN I_Quit(void)
|
||||
{
|
||||
static SDL_bool quiting = SDL_FALSE;
|
||||
|
||||
/* prevent recursive I_Quit() */
|
||||
if (quiting) goto death;
|
||||
if (is_quitting)
|
||||
abort();
|
||||
|
||||
is_quitting = true;
|
||||
SDL_ShowCursor(SDL_TRUE);
|
||||
quiting = SDL_FALSE;
|
||||
|
||||
I_ShutdownConsole();
|
||||
M_SaveConfig(NULL); //save game config, cvars..
|
||||
D_SaveBan(); // save the ban list
|
||||
@@ -1888,7 +1889,7 @@ FUNCNORETURN void ATTRNORETURN I_Quit(void)
|
||||
}
|
||||
if (myargmalloc)
|
||||
free(myargv); // Deallocate allocated memory
|
||||
death:
|
||||
|
||||
W_Shutdown();
|
||||
exit(0);
|
||||
}
|
||||
@@ -2314,12 +2315,17 @@ static void pathonly(char *s)
|
||||
size_t j;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
if (s[j] == ':') s[j+1] = 0;
|
||||
else s[j] = 0;
|
||||
if (s[j] == ':')
|
||||
s[j+1] = 0;
|
||||
else
|
||||
s[j] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief search for srb2.srb in the given path
|
||||
|
||||
+266
-98
@@ -84,15 +84,20 @@
|
||||
#endif
|
||||
|
||||
// maximum number of windowed modes (see windowedModes[][])
|
||||
#define MAXWINMODES (22)
|
||||
#define MAXWINMODES (128)
|
||||
|
||||
/** \brief
|
||||
*/
|
||||
static INT32 numVidModes = -1;
|
||||
static void I_FillScreenResolutionsList(boolean force);
|
||||
|
||||
/** \brief
|
||||
*/
|
||||
static char vidModeName[33][32]; // allow 33 different modes
|
||||
typedef struct
|
||||
{
|
||||
char name[10];
|
||||
INT32 w;
|
||||
INT32 h;
|
||||
} video_mode_t;
|
||||
|
||||
static video_mode_t windowedModes[MAXWINMODES] = {{"320x200", 320, 200}}; // make sure the default mode exists
|
||||
static const char *fallback_resolution_name = "Fallback";
|
||||
static int vid_nummodes = 1;
|
||||
|
||||
rendermode_t rendermode = render_none;
|
||||
|
||||
@@ -139,9 +144,6 @@ static SDL_bool disable_mouse = SDL_FALSE;
|
||||
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
|
||||
#define MOUSEBUTTONS_MAX MOUSEBUTTONS
|
||||
|
||||
// first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT
|
||||
static INT32 firstEntry = 0;
|
||||
|
||||
// Total mouse motion X/Y offsets
|
||||
static INT32 mousemovex = 0, mousemovey = 0;
|
||||
|
||||
@@ -155,42 +157,13 @@ static SDL_bool usesdl2soft = SDL_FALSE;
|
||||
static SDL_bool borderlesswindow = SDL_FALSE;
|
||||
|
||||
// SDL2 vars
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
static SDL_Window *window = NULL;
|
||||
static SDL_Renderer *renderer = NULL;
|
||||
static SDL_Texture *texture = NULL;
|
||||
#ifdef HWRENDER
|
||||
static SDL_GLContext sdlglcontext = NULL;
|
||||
#endif
|
||||
static SDL_bool havefocus = SDL_TRUE;
|
||||
static const char *fallback_resolution_name = "Fallback";
|
||||
|
||||
// windowed video modes from which to choose from.
|
||||
static INT32 windowedModes[MAXWINMODES][2] =
|
||||
{
|
||||
{2560,1440}, // 1.66
|
||||
{1920,1200}, // 1.60,6.00
|
||||
{1920,1080}, // 1.66
|
||||
{1680,1050}, // 1.60,5.25
|
||||
{1600,1200}, // 1.33
|
||||
{1600, 900}, // 1.66
|
||||
{1366, 768}, // 1.66
|
||||
{1440, 900}, // 1.60,4.50
|
||||
{1280,1024}, // 1.33?
|
||||
{1280, 960}, // 1.33,4.00
|
||||
{1280, 800}, // 1.60,4.00
|
||||
{1280, 720}, // 1.66
|
||||
{1152, 864}, // 1.33,3.60
|
||||
{1024, 768}, // 1.33,3.20
|
||||
{ 960, 600}, // 1.33,3.20
|
||||
{ 800, 600}, // 1.33,2.50
|
||||
{ 735, 415}, // 1.33,2.50
|
||||
{ 640, 480}, // 1.33,2.00
|
||||
{ 640, 400}, // 1.60,2.00
|
||||
{ 500, 300}, // 1.33
|
||||
{ 320, 240}, // 1.33,1.00
|
||||
{ 320, 200}, // 1.60,1.00
|
||||
};
|
||||
|
||||
#define CUSTOMMODENUM 9999
|
||||
static INT32 custom_width = 0;
|
||||
static INT32 custom_height = 0;
|
||||
|
||||
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
||||
static void Impl_SetWindowIcon(void);
|
||||
@@ -516,11 +489,20 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
return;
|
||||
}
|
||||
|
||||
if (windowmoved && rendermode == render_opengl)
|
||||
if (windowmoved)
|
||||
{
|
||||
I_CheckDesktopRes();
|
||||
|
||||
// if we say moved our game window to a different screen
|
||||
// refetch our resolutions
|
||||
I_FillScreenResolutionsList(false);
|
||||
#ifdef HWRENDER
|
||||
#ifdef USE_FBO_OGL
|
||||
I_DownSample();
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
I_DownSample();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
windowmoved = SDL_FALSE;
|
||||
}
|
||||
@@ -537,7 +519,8 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
|
||||
if (!firsttimeonmouse)
|
||||
{
|
||||
if (cv_usemouse.value) I_StartupMouse();
|
||||
if (cv_usemouse.value)
|
||||
I_StartupMouse();
|
||||
}
|
||||
}
|
||||
else if (!mousefocus && !kbfocus)
|
||||
@@ -1219,9 +1202,9 @@ static void VID_Command_ModeList_f(void)
|
||||
"Under opengl, fullscreen only supports native desktop resolution.\n"
|
||||
"Under software, the mode is stretched up to desktop resolution.\n");
|
||||
|
||||
for (i = 0; i < MAXWINMODES; i++)
|
||||
for (i = 0; i < vid_nummodes; i++)
|
||||
{
|
||||
CONS_Printf("%2d: %dx%d\n", i, windowedModes[i][0], windowedModes[i][1]);
|
||||
CONS_Printf("%2d: %dx%d\n", i, windowedModes[i].w, windowedModes[i].h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1260,7 +1243,7 @@ static void I_CheckDesktopRes(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (SDL_GetDesktopDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1275,6 +1258,11 @@ boolean I_CheckNativeRes(void)
|
||||
return (vid.width == desktopwidth && vid.height == desktopheight);
|
||||
}
|
||||
|
||||
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
|
||||
{
|
||||
return (width > desktopwidth || height > desktopheight);
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void)
|
||||
@@ -1426,7 +1414,7 @@ void I_FinishUpdate(void)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
OglSdlFinishUpdate(cv_vidwait.value);
|
||||
OglSdlFinishUpdate(window);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1505,13 +1493,207 @@ void I_SetPalette(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the canonical resolutions are always available
|
||||
static const struct {
|
||||
const int w, h;
|
||||
} canonicals[] = {
|
||||
{1920, 1200}, // 16:10
|
||||
{1280, 800}, // 16:10
|
||||
{ 960, 600}, // 16:10
|
||||
{ 640, 400}, // 16:10
|
||||
{ 320, 200}, // Vanilla Doom
|
||||
};
|
||||
static const int num_canonicals = sizeof(canonicals)/sizeof(*canonicals);
|
||||
|
||||
// [FG] sort resolutions by width first and height second
|
||||
static int cmp_resolutions(const void *a, const void *b)
|
||||
{
|
||||
const video_mode_t *ma = (const video_mode_t *) a;
|
||||
const video_mode_t *mb = (const video_mode_t *) b;
|
||||
|
||||
return (ma->w == mb->w) ? mb->h - ma->h : mb->w - ma->w;
|
||||
}
|
||||
|
||||
static void I_AppendResolution(SDL_DisplayMode *mode, int *list_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < *list_size; i++)
|
||||
if (windowedModes[i].w == mode->w
|
||||
&& windowedModes[i].h == mode->h)
|
||||
return;
|
||||
|
||||
snprintf(windowedModes[*list_size].name,
|
||||
sizeof(windowedModes[*list_size].name),
|
||||
"%dx%d", mode->w, mode->h);
|
||||
windowedModes[*list_size].w = mode->w;
|
||||
windowedModes[*list_size].h = mode->h;
|
||||
|
||||
(*list_size)++;
|
||||
}
|
||||
|
||||
// small helper to check if a video mode is canonical
|
||||
static boolean IsModeCanonical(int w, int h)
|
||||
{
|
||||
for (int i = 0; i < num_canonicals; i++)
|
||||
{
|
||||
if (canonicals[i].w == w && canonicals[i].h == h)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if our desired resolution already is in the videomode list
|
||||
static int IsCustomResolutionInList(int list_size)
|
||||
{
|
||||
INT32 custom_w = cv_scr_width.value;
|
||||
INT32 custom_h = cv_scr_height.value;
|
||||
|
||||
// startup
|
||||
if (!custom_w || !custom_h)
|
||||
return -2;
|
||||
|
||||
// invalid resolution
|
||||
// dont even attempt to add it
|
||||
if (custom_w < BASEVIDWIDTH || custom_w > MAXVIDWIDTH
|
||||
|| custom_h < BASEVIDHEIGHT || custom_h > MAXVIDHEIGHT)
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < list_size; i++)
|
||||
{
|
||||
if (windowedModes[i].w == custom_w && windowedModes[i].h == custom_h)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// I_FillScreenResolutionsList
|
||||
// Get all the supported screen resolutions
|
||||
// and fill the list with them
|
||||
//
|
||||
static void I_FillScreenResolutionsList(boolean force)
|
||||
{
|
||||
int currentDisplayIndex = -1;
|
||||
static int oldDisplayIndex = -1;
|
||||
SDL_DisplayMode mode;
|
||||
int i = 0, list_size = 0;
|
||||
int count = 0;
|
||||
char custom_resolution[10];
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
// No valid index
|
||||
if (currentDisplayIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// didnt change screen, no need to redo the list
|
||||
if (!force && currentDisplayIndex == oldDisplayIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
oldDisplayIndex = currentDisplayIndex;
|
||||
|
||||
// Don't call SDL_ListModes if SDL has not been initialized
|
||||
count = SDL_GetNumDisplayModes(currentDisplayIndex);
|
||||
|
||||
list_size = 0;
|
||||
|
||||
// on success, SDL_GetNumDisplayModes() always returns at least 1
|
||||
if (count > 0)
|
||||
{
|
||||
// -2 for the desired resolution and for NULL
|
||||
count = min(count, MAXWINMODES - 2 - num_canonicals);
|
||||
|
||||
for (i = count - 1 + num_canonicals; i >= 0; i--)
|
||||
{
|
||||
// make sure the canonical resolutions are always available
|
||||
if (i > count - 1)
|
||||
{
|
||||
mode.w = canonicals[i - count].w;
|
||||
mode.h = canonicals[i - count].h;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_GetDisplayMode(currentDisplayIndex, i, &mode);
|
||||
}
|
||||
|
||||
I_AppendResolution(&mode, &list_size);
|
||||
}
|
||||
|
||||
windowedModes[list_size].name[0] = '\0';
|
||||
}
|
||||
|
||||
const int customresinlist = IsCustomResolutionInList(list_size);
|
||||
|
||||
if (customresinlist == 0)
|
||||
{
|
||||
// did not find mode from list, make custom resolution if the values somewhat make sense
|
||||
if (list_size < MAXWINMODES)
|
||||
{
|
||||
snprintf(custom_resolution, sizeof(custom_resolution), "%dx%d", cv_scr_width.value, cv_scr_height.value);
|
||||
|
||||
// [FG] if the desired resolution not in the list, append it
|
||||
snprintf(windowedModes[list_size].name,
|
||||
sizeof(windowedModes[list_size].name),
|
||||
"%dx%d", cv_scr_width.value, cv_scr_height.value);
|
||||
windowedModes[list_size].w = cv_scr_width.value;
|
||||
windowedModes[list_size].h = cv_scr_height.value;
|
||||
list_size++;
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n");
|
||||
}
|
||||
else if (customresinlist == -1)
|
||||
CONS_Alert(CONS_ERROR, "Could not set custom resolution!\n");
|
||||
|
||||
// [FG] sort the list
|
||||
SDL_qsort(windowedModes, list_size, sizeof(*windowedModes), cmp_resolutions);
|
||||
|
||||
// if we have more video modes than we can list
|
||||
// try to shrink the list, lowest resolutions first
|
||||
// whilst keeping the canonicals
|
||||
if (list_size > MAXMODEDESCS)
|
||||
{
|
||||
// list is sorted from largest to smallest, so start at the end
|
||||
for (i = list_size - 1; i >= 0 && list_size > MAXMODEDESCS; i--)
|
||||
{
|
||||
if (IsModeCanonical(windowedModes[i].w, windowedModes[i].h))
|
||||
continue;
|
||||
|
||||
// Should we like, instead prioritize checking for non aspect correct resolutions to remove?
|
||||
|
||||
// we gotta shift everything
|
||||
// due to canonicals we cant just shrink the list
|
||||
for (int k = i; k < list_size - 1; k++)
|
||||
{
|
||||
windowedModes[k] = windowedModes[k + 1];
|
||||
}
|
||||
|
||||
list_size--;
|
||||
}
|
||||
}
|
||||
|
||||
windowedModes[list_size].name[0] = '\0';
|
||||
vid_nummodes = list_size;
|
||||
|
||||
// be sure to update the video menu
|
||||
if (menuactive &&
|
||||
currentMenu == &OP_VideoModeDef)
|
||||
M_VideoModeMenu(0);
|
||||
}
|
||||
|
||||
// return number of fullscreen + X11 modes
|
||||
INT32 VID_NumModes(void)
|
||||
{
|
||||
if (USE_FULLSCREEN && numVidModes != -1)
|
||||
return numVidModes - firstEntry;
|
||||
else
|
||||
return MAXWINMODES;
|
||||
return vid_nummodes;
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modeNum)
|
||||
@@ -1521,42 +1703,34 @@ const char *VID_GetModeName(INT32 modeNum)
|
||||
return fallback_resolution_name;
|
||||
}
|
||||
|
||||
if (modeNum > MAXWINMODES)
|
||||
if (modeNum > vid_nummodes)
|
||||
return NULL;
|
||||
|
||||
sprintf(&vidModeName[modeNum][0], "%dx%d",
|
||||
windowedModes[modeNum][0],
|
||||
windowedModes[modeNum][1]);
|
||||
|
||||
return &vidModeName[modeNum][0];
|
||||
return windowedModes[modeNum].name;
|
||||
}
|
||||
|
||||
INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXWINMODES; i++)
|
||||
for (i = 0; i < vid_nummodes; i++)
|
||||
{
|
||||
if (windowedModes[i][0] == w && windowedModes[i][1] == h)
|
||||
if (windowedModes[i].w == w && windowedModes[i].h == h)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// did not find mode from list, make custom resolution if the values somewhat make sense
|
||||
// opengl mode does not mind about max resolution defined in screen.h
|
||||
// if not using opengl, check against the maximum as well
|
||||
if ((w >= BASEVIDWIDTH && h >= BASEVIDHEIGHT) &&
|
||||
(rendermode == render_opengl || (w <= MAXVIDWIDTH && h <= MAXVIDHEIGHT)))
|
||||
{
|
||||
custom_width = w;
|
||||
custom_height = h;
|
||||
return CUSTOMMODENUM;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void VID_RefreshModeList(void)
|
||||
{
|
||||
// check if we even need to rebuild the list
|
||||
if (IsCustomResolutionInList(vid_nummodes) == 0)
|
||||
I_FillScreenResolutionsList(true);
|
||||
}
|
||||
|
||||
void VID_PrepareModeList(void)
|
||||
{
|
||||
// Under SDL2, we just use the windowed modes list, and scale in windowed fullscreen.
|
||||
@@ -1588,17 +1762,10 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
{
|
||||
vid.recalc = true;
|
||||
|
||||
if (modeNum >= 0 && modeNum < MAXWINMODES)
|
||||
if (modeNum >= 0 && modeNum < vid_nummodes)
|
||||
{
|
||||
vid.width = windowedModes[modeNum][0];
|
||||
vid.height = windowedModes[modeNum][1];
|
||||
vid.modenum = modeNum;
|
||||
}
|
||||
else if (modeNum == CUSTOMMODENUM && custom_width && custom_height)
|
||||
{
|
||||
// at this point these values are assumed to be okay
|
||||
vid.width = custom_width;
|
||||
vid.height = custom_height;
|
||||
vid.width = windowedModes[modeNum].w;
|
||||
vid.height = windowedModes[modeNum].h;
|
||||
vid.modenum = modeNum;
|
||||
}
|
||||
else
|
||||
@@ -1631,7 +1798,6 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static SDL_bool Impl_CreateContext(void)
|
||||
{
|
||||
// Renderer-specific stuff
|
||||
@@ -1654,6 +1820,9 @@ static SDL_bool Impl_CreateContext(void)
|
||||
I_Error("Failed to set up GL context: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
// be sure to fill the resolution list the moment we have a window
|
||||
I_FillScreenResolutionsList(false);
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
@@ -1695,6 +1864,9 @@ static SDL_bool Impl_CreateContext(void)
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
|
||||
// be sure to fill the resolution list the moment we have a window
|
||||
I_FillScreenResolutionsList(false);
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
@@ -1932,8 +2104,6 @@ void I_StartupGraphics(void)
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
||||
VID_Command_ModeList_f();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
@@ -1957,6 +2127,9 @@ void I_StartupGraphics(void)
|
||||
vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's
|
||||
vid.recalc = true; // Set up the console stufff
|
||||
|
||||
// be sure to print AFTER window creation
|
||||
VID_Command_ModeList_f();
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
I_ShutdownTTF();
|
||||
#endif
|
||||
@@ -1997,16 +2170,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;
|
||||
@@ -2033,17 +2201,17 @@ UINT32 I_GetRefreshRate(void)
|
||||
|
||||
static void Impl_SetVsync(void)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if (renderer)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
if (!renderer && rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
if (rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
}
|
||||
#endif
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if (renderer)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_SetBorderlessWindow(void)
|
||||
|
||||
@@ -461,7 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
gme_track_info(emu, &info, 0);
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
mem = Z_Malloc(len, PU_SOUND, NULL);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
@@ -499,7 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
gme_track_info(emu, &info, 0);
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
mem = Z_Malloc(len, PU_SOUND, NULL);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
|
||||
+2
-38
@@ -63,25 +63,15 @@ PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
#if defined (__unix__)
|
||||
static boolean xwaylandcrap = false;
|
||||
#endif
|
||||
|
||||
boolean UseScreenFBO(void)
|
||||
{
|
||||
return ((supportFBO && cv_glframebuffer.value && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (supportFBO && xwaylandcrap)
|
||||
#endif
|
||||
);
|
||||
return (supportFBO && cv_glframebuffer.value && downsample);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \brief SDL video display surface
|
||||
*/
|
||||
INT32 oglflags = 0;
|
||||
SDL_GLContext sdlglcontext = NULL;
|
||||
|
||||
void *GetGLFunc(const char *proc)
|
||||
{
|
||||
@@ -201,17 +191,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
supportNPO2tex = true;
|
||||
|
||||
glanisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
// TODO: delet this since nvidia fixed their shit on 575
|
||||
char videodriver[4] = {'S','D','L',0};
|
||||
if (supportFBO && strstr((const char*)gl_renderer, "NVIDIA")
|
||||
&& (*strncpy(videodriver, SDL_GetCurrentVideoDriver(), sizeof(videodriver)-1) != '\0')
|
||||
&& (strncasecmp("x11", videodriver, 4) == 0))
|
||||
xwaylandcrap = true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
@@ -241,22 +220,14 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
|
||||
\return void
|
||||
*/
|
||||
void OglSdlFinishUpdate(boolean waitvbl)
|
||||
void OglSdlFinishUpdate(SDL_Window *window)
|
||||
{
|
||||
static boolean oldwaitvbl = false;
|
||||
int sdlw, sdlh;
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
const boolean usefbo = UseScreenFBO();
|
||||
#endif
|
||||
|
||||
if (oldwaitvbl != waitvbl)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
|
||||
}
|
||||
|
||||
oldwaitvbl = waitvbl;
|
||||
|
||||
SDL_GetWindowSize(window, &sdlw, &sdlh);
|
||||
HWR_MakeScreenFinalTexture();
|
||||
|
||||
@@ -289,13 +260,6 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
if (!I_CheckNativeRes() || WipeInAction)
|
||||
#endif
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
if (loaded_config)
|
||||
xwaylandcrap = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
||||
+1
-3
@@ -20,11 +20,9 @@
|
||||
|
||||
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
void OglSdlFinishUpdate(SDL_Window *window);
|
||||
boolean VID_LoadOGLAPI(void);
|
||||
|
||||
extern SDL_Renderer *renderer;
|
||||
extern SDL_GLContext sdlglcontext;
|
||||
extern Uint16 realwidth;
|
||||
extern Uint16 realheight;
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern SDL_bool consolevent;
|
||||
extern SDL_bool framebuffer;
|
||||
|
||||
#include "../m_fixed.h"
|
||||
|
||||
// SDL2 stub macro
|
||||
@@ -67,21 +64,6 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
|
||||
#define SDL_JDEADZONE 153
|
||||
#undef SDL_JDEADZONE
|
||||
|
||||
// So we can call this from i_video event loop
|
||||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
// Needed for some WIN32 functions
|
||||
extern SDL_Window *window;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
+9
-3
@@ -2992,7 +2992,9 @@ INT32 V_CreditStringWidth(const char *string)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - CRED_FONTSTART;
|
||||
if (c < 0 || c >= CRED_FONTSIZE)
|
||||
@@ -3070,7 +3072,9 @@ INT32 V_LevelNameWidth(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
@@ -3089,7 +3093,9 @@ INT32 V_LevelNameHeight(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
|
||||
+20
-1
@@ -1997,11 +1997,16 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag)
|
||||
|
||||
rspr = (rotsprite_t *)W_GetCachedRotPatchPwad(WADFILENUM(num),LUMPNUM(num));
|
||||
|
||||
if (rspr == NULL)
|
||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||
|
||||
if (rspr->patches[idx] == NULL)
|
||||
{
|
||||
INT32 xpivot = 0, ypivot = 0;
|
||||
|
||||
ptr = (patch_t *)W_CachePatchNum(num, PU_PATCH);
|
||||
if (ptr == NULL)
|
||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||
|
||||
// >y pivot centered
|
||||
// >x pivot not centered
|
||||
@@ -2612,6 +2617,9 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
|
||||
// Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
|
||||
UINT8 *wadData = (UINT8*)(W_CacheLumpNum(lumpnum, PU_LEVEL));
|
||||
if (wadData == NULL)
|
||||
I_Error("vres_GetMap: Invalid WadData!\n");
|
||||
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + LONG(((wadinfo_t *)wadData)->infotableofs));
|
||||
|
||||
i = LONG(((wadinfo_t *)wadData)->numlumps);
|
||||
@@ -2628,6 +2636,8 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
}
|
||||
|
||||
vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
|
||||
if (vlumps == NULL)
|
||||
I_Error("vres_GetMap: Out of memory!\n");
|
||||
|
||||
// Build the lumps, skipping over empty entries.
|
||||
for (i = 0, realentry = 0; i < numlumps; realentry++)
|
||||
@@ -2663,7 +2673,11 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
lumpnum_t lumppos = lumpnum + 1;
|
||||
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++)
|
||||
{
|
||||
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
|
||||
const char *name = W_CheckNameForNum(lumppos);
|
||||
if (name == NULL)
|
||||
continue;
|
||||
|
||||
if (memcmp(name, "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2671,10 +2685,15 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
numlumps++;
|
||||
|
||||
vlumps = (virtlump_t*)(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
|
||||
if (vlumps == NULL)
|
||||
I_Error("vres_GetMap: Out of memory!\n");
|
||||
|
||||
for (i = 0; i < numlumps; i++, lumpnum++)
|
||||
{
|
||||
// Check if it is map marker. It is not always first lump sadly, so we need to expect it anywhere
|
||||
const char *name = W_CheckNameForNum(lumpnum);
|
||||
if (name == NULL)
|
||||
continue;
|
||||
|
||||
if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0)
|
||||
{
|
||||
|
||||
+19
-16
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -651,9 +651,6 @@ void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
// No, please, don't make my PU_STATIC patch NULL! It supposed to be always valid!
|
||||
if (block->tag < 10) return;
|
||||
|
||||
block->tag = tag;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user