Compare commits

...
85 Commits
Author SHA1 Message Date
Alug b6be5bc6b4 bruh 2023-08-30 14:57:58 +02:00
Alug fca542cd4e Update README.md
v2 hope i didnt forgor smth again
2023-08-30 14:47:41 +02:00
alufolie91 e3d61b2974 v2 moment 2023-08-30 14:22:56 +02:00
alufolie91 9cb84d214e change default to off 2023-08-30 14:21:17 +02:00
indev 6a0069f08f Merge pull request #48 from Indev450/lua-feature-votehud
Add vote hud hook for lua
2023-08-30 14:51:29 +03:00
indev 4a32bb7f9f Merge pull request #47 from Indev450/fix-udatalib-warnings
Fix few warnings regarding udatalib
2023-08-30 14:45:02 +03:00
indev 3404ca63bc Merge pull request #46 from Indev450/bring-few-mobj-fields-back
Bring sprite scale and rotation mobj fields back.
2023-08-30 14:43:26 +03:00
Alug 238688047e Merge pull request #45 from Indev450/fix-cv-grrenderdistance
Fix cv_grrenderdistance not changing current_bsp_culling_distance bac…
2023-08-30 13:20:37 +02:00
indev c0e24c1119 Fix cv_grrenderdistance not changing current_bsp_culling_distance back after it was changed from max to any other value 2023-08-30 14:09:28 +03:00
alufolie91 cc2bab7736 rename some things
for obvious reasons :p
2023-08-30 12:41:22 +02:00
indev c6d0627f08 Actually fix memfree for gpu textures 2023-08-29 13:17:09 +03:00
indev 6c22b1e01a Fix 'All GPU textures' showing incorrect value in memfree command 2023-08-29 13:07:15 +03:00
alufolie91 144bddea78 Show which renderer youre using on main menu
cause some ppl dont know how to check
and we cant switch the game
2023-08-29 11:42:51 +02:00
indev 050ae2ab6d Add vote hud hook for lua. Use FEATURE_VOTEHUD global to check if this feature is available 2023-08-29 12:09:46 +03:00
alufolie91 f6da608402 Menu stuff
add missing things
rearrange saturn menu
make saturn menu and player distortion menu prettier finally
2023-08-29 10:44:00 +02:00
alufolie91 76685068fe Add Toggle to satlyhop squish effect
just for those who may dislike it
2023-08-29 10:43:16 +02:00
indev d5f1b744bb Fix few warnings regarding udatalib. Use size_t and uint8_t* instead of intptr_t since all offsets are >= 0 anyway 2023-08-29 11:18:08 +03:00
alufolie91 bd221ef0b4 Stop game from using broken draw function
"that sigsegvs at random on some maps for seeming no reason."
actually this fixed some crashes for someone who tested it
See: https://git.do.srb2.org/Galactice/Kart-Public/-/commit/095e1ac621cb0810af7a4efbe7f3fb6e242df5ab
2023-08-29 10:09:26 +02:00
alufolie91 dc42c5b8b5 Change default renderer to Opengl
also turn off 3d models by default
2023-08-29 10:05:33 +02:00
indev c29e6911b1 Merge pull request #44 from Indev450/always-show-music-credit
Return null in S_FindMusicCredit if there are no musicdefs at all
2023-08-29 10:47:11 +03:00
indev 44a31e7561 Comment out cv_smallpos 2023-08-29 10:38:36 +03:00
indev e250e706a0 Merge pull request #43 from Indev450/snowy
Snowy
2023-08-29 10:33:57 +03:00
indev 00f09421b8 Merge branch 'Saturn' into snowy 2023-08-29 10:33:10 +03:00
indev daa747805d Return null in S_FindMusicCredit if there are no musicdefs at all (thanks NepDisk for pointing at that) 2023-08-29 10:32:35 +03:00
indev 3612a9cd02 Merge pull request #42 from Indev450/hidelapemblem
Toggable Lap Emblem Animation
2023-08-29 10:21:24 +03:00
indev 78e94b66ba Merge branch 'Saturn' into hidelapemblem 2023-08-29 10:21:11 +03:00
indev 8fe9173355 Merge pull request #41 from Indev450/squishsound
Squishsound
2023-08-29 10:15:46 +03:00
indev 1210a885d4 Merge branch 'Saturn' into squishsound 2023-08-29 10:15:36 +03:00
indev 25f02f6cd3 Merge pull request #40 from Indev450/fixprecip
Fixprecip
2023-08-29 10:14:14 +03:00
indev d69b6672be Merge pull request #38 from Indev450/dont-record-demo-if-disabled
Attempt to fix demo buffer overflow crash. Also don't record demos at…
2023-08-29 10:13:21 +03:00
indev 24ccc5eee4 Merge pull request #39 from Indev450/always-show-music-credit
Don't show music credit when music is disabled
2023-08-29 10:13:01 +03:00
indev d577944143 Don't show music credit when music is disabled 2023-08-29 10:07:26 +03:00
alufolie91 c4746962bd do the thing for software renderer too
i forgor
2023-08-29 08:18:59 +02:00
alufolie91 664e8c363b raise max precip distance a bit
basically twice as far, cant go higher or else we hit sprite limit and stuff starts disappearing
2023-08-29 07:57:35 +02:00
alufolie91 b5269ebbb5 oops 2023-08-29 07:25:55 +02:00
alufolie91 52b4f65582 Improve rain/weather.
* Better thinker with more return optimisation.
* Better placement of thinking in rendering, to avoid ceiling-mounted sprite glitches.
See: https://git.do.srb2.org/STJr/SRB2/-/commit/6371de806b932d1026904937b19e13feb10fa322
2023-08-29 07:19:31 +02:00
alufolie91 e91c90329d Fix precip interpolation
See: https://git.do.srb2.org/STJr/SRB2/-/commit/6c54af377481a42f639da2db6cefe33d02918bce
2023-08-29 06:57:52 +02:00
alufolie91 ab6f33929d don't check flippedness in HWR_RotateSpritePolyToAim
if the mobj is actually a precipmobj!

precipmobj_t does not have eflags, so P_MobjFlip checking it would actually be accessing memory addresses beyond the end of the struct

perhaps this fixes a rare crash in P_MobjFlip on maps with snow and rain

See: https://git.do.srb2.org/STJr/SRB2/-/commit/197da95a232da92e61f88ee27c754e8671a6624f
2023-08-29 06:49:10 +02:00
Alug 557187a305 Update README.md
smh these confused ppl, ill readd them when next stable build
2023-08-29 06:43:46 +02:00
alufolie91 47f194b82e fix the wanted recticle
also small fix to big players
2023-08-28 22:28:41 +02:00
indev 5da6739077 Don't play slam sound too often 2023-08-28 13:56:19 +03:00
indev 2f689c1ab7 Merge pull request #37 from Indev450/showmusiccredit-command
Add showmusiccredit command
2023-08-28 10:54:08 +03:00
indev 82d30b5abf Don't play landing sound on really small jumps 2023-08-28 10:29:44 +03:00
alufolie91 8c3b6911a3 remove unused thing
we removed the shear fucntion since it completely broke sprite rendering anyways so this stuff goes unused and is just clutter
2023-08-28 01:12:48 +02:00
Alug 294a459fc2 Update README.md
eeeehehehheh
hope i didnt forgor smth again
2023-08-28 01:02:36 +02:00
alufolie91 44c9b87557 Revert "Clean up and simplify zone memory allocation" and "Some memory allocations have been properly aligned" Fixes #35
seems like screwing with the extrabytes/alignbits specifically in the zone memory allocations corrupt something in 32bit software mode
reverting this fixes the issue but comes with a small performance hit on busy maps
2023-08-28 00:52:03 +02:00
alufolie91 911264ccb3 kill smallposition toggle for now and add minimap head size toggle instead
eeeeeeeeeeeeeeeeeeee
2023-08-27 22:33:21 +02:00
indev 9936e38f20 Merge pull request #36 from hayaunderscore/no-break-moment
Fix overlapping speedometer text
2023-08-27 20:57:09 +03:00
haya e1f402b86c i am stupid
💀
2023-08-28 01:37:55 +08:00
indev 124bfe6ca9 Merge pull request #34 from hayaunderscore/visuals-and-friends
Visuals and friends
2023-08-27 20:16:35 +03:00
haya e3b1dba13c Remove precipitation salty values
As per suggestion
2023-08-28 01:06:37 +08:00
haya 6cbd7503f9 revert freeslot limit from master
that was for tmm sorry
2023-08-28 01:03:19 +08:00
haya 1cc4c2df72 Merge branch 'Indev450:Saturn' into Saturn 2023-08-27 18:27:58 +08:00
xyzzy 5726658729 Patch in listskins for Saturn :3
* Listskins lists all loaded skins.
    * It's fun
    * Paginated display.
2023-08-27 13:22:28 +03:00
xyzzy d0a307e5b5 Make alias print a list of all defined aliases.
* Alias with no args not only prints out the help text but all
      command aliases.
    * Alias with just one argument prints all commands that begin with
      the first argument.
2023-08-27 13:22:11 +03:00
indev 9208a7233f Redo slamsound using MFE_JUSTHITFLOOR 2023-08-27 11:13:47 +03:00
haya e58c66facd Merge branch 'Indev450:Saturn' into Saturn 2023-08-27 15:25:18 +08:00
hayaunderscore 8117b528ab fix hanged yoffset upon turning off saltyhop mid start drift 2023-08-27 15:22:46 +08:00
hayaunderscore 9f4df6b80d nuh uh 2023-08-27 15:18:12 +08:00
alufolie91 355a1c2046 fix up 3dmodels
those things werent affected by setting smth in spriteoffsets
also cleans up the code alot

taken from srb2s model plus branch
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1840
2023-08-27 09:06:53 +02:00
hayaunderscore 00d383cc28 Merge branch 'Saturn' of github.com:hayaunderscore/SRB2Kart-Saturn into Saturn 2023-08-27 12:39:06 +08:00
hayaunderscore e46391992a fix precipitation 2023-08-27 12:39:00 +08:00
haya fff8b24309 Merge branch 'Indev450:Saturn' into Saturn 2023-08-27 10:28:11 +08:00
hayaunderscore 59f9705b93 Distracting sprite scaling for saltyhop
Mayo asked for this.
2023-08-27 09:57:08 +08:00
alufolie91 7be1c58ba5 ooof forgot to remove those
sprite offsets shouldnt have two states which are either interpolated and non interpolated goddamit
2023-08-27 03:47:35 +02:00
hayaunderscore da1df719e3 HARDCODED SALTYHOP
`hardcodehop on` on console :)
2023-08-27 09:12:11 +08:00
hayaunderscore b626c095d0 Gray out speedometer option 2023-08-27 08:26:57 +08:00
haya 3df993184b Merge branch 'Indev450:Saturn' into Saturn 2023-08-27 07:34:01 +08:00
alufolie91 ec9c8dba1b Revert "P_RandomFixed should return the same result"
goddamit, it seems to cause desynchs in rare cases
and here i thought it may help with desynchs
2023-08-27 00:56:35 +02:00
alufolie91 171d36158c Toggable Lap Emblem Animation
hides the animation that happens when you do a lap
toggable with "showlapemblem" and in saturn options
2023-08-27 00:45:04 +02:00
indev 22a84a5504 Bring sprite scale and rotation mobj fields back. Hopefully this wouldn't cause synch failures 2023-08-26 15:05:21 +03:00
hayaunderscore 53ead1007e forgor :skull 2023-08-26 14:38:46 +08:00
hayaunderscore e852034ca8 V2 speedometer nonsense
you can get extra.kart from me (for now). It's not the same as snowy_files.kart :V
2023-08-26 14:33:14 +08:00
alufolie91 00112bc4c8 Two small things from Snowy-Kart
- small position number (has been made toggable)
- toggable minimap playernames

from: https://github.com/JadenArcm/Snowy-Kart
2023-08-26 07:27:23 +02:00
hayaunderscore 4a74eaa6b0 mkay 2023-08-26 13:17:03 +08:00
hayaunderscore ed04181899 readd smaller position with input display 2023-08-26 10:02:28 +08:00
hayaunderscore ed86f2c227 tmm stuff 2023-08-26 09:34:49 +08:00
indev 1175247614 Move stretchonground in mobj_t at the end of struct because game assumes precipmobj and mobj have same layout in rendering code -_- 2023-08-25 21:32:26 +03:00
indev f8825c5024 Add showmusiccredit command 2023-08-25 20:48:38 +03:00
alufolie91 9a8ef2c7e0 aaaand add it to the menu 2023-08-25 19:26:02 +02:00
alufolie91 5a7626d88e add toggable sound effect when player squishes after landing
"slamsound" toggles it
2023-08-25 19:19:04 +02:00
alufolie91 6457af1cce fix even more openmpt errors at startup X) 2023-08-25 16:47:00 +02:00
alufolie91 b18b3bf17e OpenMPT bugfixes
remove those startup errors and smoler fixes
goddamn my dumbass made the musicsystem restart at gamestart
2023-08-25 16:11:21 +02:00
alufolie91 1ba44ad8c4 bruh moment 2023-08-25 15:17:33 +02:00
indev d5b28577c1 Attempt to fix demo buffer overflow crash. Also don't record demos at all when netdemo_record is set to Disabled 2023-08-25 13:59:53 +03:00
46 changed files with 1547 additions and 753 deletions

No files matched your search

+10 -1
View File
@@ -10,6 +10,13 @@
- OpenMPT for Tracker module playback (Complete with filters) fixed looping issues while even sounding better than the old GME playback
- The minimal brightness with Shaders can be configured, now you can seeeee in dark areas (0-255 , uses Sector brightness values)
- Lua hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
- Lua hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
- Saltyhop! do a funny hop
- Smaller Speedometer (optional / requieres extra.kart file)
- Record Attack input display can now be used everywhere
- Smaller minimap icons and also show player names on the minimap (toggable)
- "showmusiccredits" command, shows you the current music track again
- "listskins" show a list of all skins currently loaded
- Visual Portals from Haya´s HEP Client
- Toggable lowercase menu´s also from Haya´s HEP client
- Everything that Galaxy has
@@ -22,8 +29,10 @@
- Configurable timeout for waiting to join a full server (in vanilla this is capped to 5 minutes before it boots you out)
- Characters now spin in skin selection menu (configurable)
- HTTP Addon download speed has been raised dramatically (configurable with "downloadspeed" command)
- Zone memory allocations have been rewritten, speeds up some map loading, and may improve performance on busy maps
- HWR Drawnodes have been refactored, this should fix a few rare crashes esp in regards to OpenGL Visportals
- The Position Number in the corner is alot smaller now (half the size!)
- Toggable Lap animation
- Main menu shows the current renderer being used
- MSAA and A2C Antialiasing support (Configurable in renderer.txt file)
## Performance / Debugging
+35 -1
View File
@@ -634,10 +634,44 @@ static void COM_ExecuteString(char *ptext)
static void COM_Alias_f(void)
{
cmdalias_t *a;
const char *alias_format = "\x87%-8s:\x80 %s\n";
int argc = COM_Argc();
if (COM_Argc() < 3)
if (argc == 2)
{
const char *begin = COM_Argv(1);
size_t szBegin = strlen(begin);
/* Display all aliases that start with `begin`. */
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)
{
if (strncmp(begin, head->name, szBegin) == 0)
{
CONS_Printf(alias_format, head->name, head->value);
count++;
}
}
if (count == 0)
{
CONS_Printf(M_GetText("There are none.\n"));
}
return;
}
else if (argc < 3)
{
/* 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)
{
CONS_Printf(alias_format, head->name, head->value);
}
return;
}
+17 -17
View File
@@ -153,25 +153,25 @@ consvar_t cons_backcolor = {"con_backcolor", "Black", CV_CALL|CV_SAVE, backcolor
static CV_PossibleValue_t menuhighlight_cons_t[] =
{
{0, "Game type"},
{V_YELLOWMAP, "Always yellow"},
{V_PURPLEMAP, "Always purple"},
{V_GREENMAP, "Always green"},
{V_BLUEMAP, "Always blue"},
{V_REDMAP, "Always red"},
{V_GRAYMAP, "Always gray"},
{V_ORANGEMAP, "Always orange"},
{V_SKYMAP, "Always sky-blue"},
{V_GOLDMAP, "Always gold"},
{V_LAVENDERMAP, "Always lavender"},
{V_TEAMAP, "Always tea-green"},
{V_STEELMAP, "Always steel-blue"},
{V_PINKMAP, "Always pink"},
{V_BROWNMAP, "Always brown"},
{V_PEACHMAP, "Always peach"},
{0, "Gametype Default"},
{V_YELLOWMAP, "Always Yellow"},
{V_PURPLEMAP, "Always Purple"},
{V_GREENMAP, "Always Green"},
{V_BLUEMAP, "Always Blue"},
{V_REDMAP, "Always Red"},
{V_GRAYMAP, "Always Gray"},
{V_ORANGEMAP, "Always Orange"},
{V_SKYMAP, "Always Sky-Blue"},
{V_GOLDMAP, "Always Gold"},
{V_LAVENDERMAP, "Always Lavender"},
{V_TEAMAP, "Always Tea-Green"},
{V_STEELMAP, "Always Steel-Blue"},
{V_PINKMAP, "Always Pink"},
{V_BROWNMAP, "Always Brown"},
{V_PEACHMAP, "Always Peach"},
{0, NULL}
};
consvar_t cons_menuhighlight = {"menuhighlight", "Game type", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg);
+11
View File
@@ -957,9 +957,12 @@ static boolean AddIWAD(void)
}
}
boolean found_extra_kart;
static void IdentifyVersion(void)
{
const char *srb2waddir = NULL;
found_extra_kart = false;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
// change to the directory where 'srb2.srb' is found
@@ -1012,6 +1015,11 @@ static void IdentifyVersion(void)
#ifdef USE_PATCH_KART
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles);
#endif
// completely optional
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra.kart"))) {
D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles);
found_extra_kart = true;
}
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
@@ -1337,6 +1345,9 @@ void D_SRB2Main(void)
#endif //ifndef DEVELOP
if (found_extra_kart) // found the funny, add it in!
mainwads++;
//
// search for maps
//
+2
View File
@@ -25,6 +25,8 @@ extern boolean usehome; //Alam: which path?
extern const char *pandf; //Alam: how to path?
extern char srb2path[256]; //Alam: SRB2's Home
extern boolean found_extra_kart; // for use in k_kart.c
// the infinite loop of D_SRB2Loop() called from win_main for windows version
void D_SRB2Loop(void) FUNCNORETURN;
+124
View File
@@ -190,6 +190,9 @@ static void Command_ShowTime_f(void);
static void Command_Isgamemodified_f(void);
static void Command_Cheats_f(void);
static void Command_ListSkins(void);
#ifdef _DEBUG
static void Command_Togglemodified_f(void);
#ifdef HAVE_BLUA
@@ -466,6 +469,12 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
// Intermission time Tails 04-19-2002
@@ -700,6 +709,8 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_powerstones);
CV_RegisterVar(&cv_competitionboxes);
CV_RegisterVar(&cv_matchboxes);
CV_RegisterVar(&cv_slamsound);
/*CV_RegisterVar(&cv_recycler);
CV_RegisterVar(&cv_teleporters);
@@ -765,6 +776,11 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_minihead);
CV_RegisterVar(&cv_showminimapnames);
CV_RegisterVar(&cv_showlapemblem);
CV_RegisterVar(&cv_showtrackaddon);
@@ -954,6 +970,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_mini_yoffset);
CV_RegisterVar(&cv_want_xoffset);
CV_RegisterVar(&cv_want_yoffset);
CV_RegisterVar(&cv_showinput);
CV_RegisterVar(&cv_newspeedometer);
CV_RegisterVar(&cv_saltyhop);
CV_RegisterVar(&cv_saltyhopsfx);
CV_RegisterVar(&cv_saltysquish);
//CV_RegisterVar(&cv_crosshair);
//CV_RegisterVar(&cv_crosshair2);
@@ -1142,8 +1164,34 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_discordstreamer);
CV_RegisterVar(&cv_discordasks);
#endif
COM_AddCommand("listskins", Command_ListSkins);
}
/**
* Searches the skins list for a skin of the "realname", if found, changes
* the CVAR value to be the "name" of the skin.
* \sa cv_skin, Skin_OnChange, Skin2_OnChange
* \author karen
*/
static void Skin_FindRealNameSkin(consvar_t *cvar)
{
// Not the best way to implements this but it will do.
int i;
const char *value = cvar->string;
for (i = 0; i < numskins; i++)
{
if (strncmp(value, skins[i].realname, sizeof skins[i].realname) == 0)
{
// Change the cvar to be the value of the name.
CV_StealthSet(cvar, skins[i].name);
return;
}
}
}
/** Checks if a name (as received from another player) is okay.
* A name is okay if it is no fewer than 1 and no more than ::MAXPLAYERNAME
* chars long (not including NUL), it does not begin or end with a space,
@@ -5736,6 +5784,8 @@ static void Name4_OnChange(void)
*/
static void Skin_OnChange(void)
{
Skin_FindRealNameSkin(&cv_skin);
if (!Playing())
return; // do whatever you want
@@ -5762,6 +5812,8 @@ static void Skin_OnChange(void)
*/
static void Skin2_OnChange(void)
{
Skin_FindRealNameSkin(&cv_skin2);
if (!Playing() || !splitscreen)
return; // do whatever you want
@@ -5776,6 +5828,8 @@ static void Skin2_OnChange(void)
static void Skin3_OnChange(void)
{
Skin_FindRealNameSkin(&cv_skin3);
if (!Playing() || splitscreen < 2)
return; // do whatever you want
@@ -5790,6 +5844,8 @@ static void Skin3_OnChange(void)
static void Skin4_OnChange(void)
{
Skin_FindRealNameSkin(&cv_skin4);
if (!Playing() || splitscreen < 3)
return; // do whatever you want
@@ -5802,6 +5858,74 @@ static void Skin4_OnChange(void)
}
}
static void Command_ListSkins(void)
{
int i;
int page = 0;
int numpages = numskins / 10 + (numskins % 10 ? 1 : 0);
int longest_name = 0;
if (COM_Argc() > 1)
{
if (sscanf(COM_Argv(1), " %d", &page) == 0)
{
CONS_Printf("Expected a number.\n");
return;
}
else if (page > numpages)
{
CONS_Printf("There are only %d pages.\n", numpages);
return;
}
else if (page < 0)
{
CONS_Printf("Page number cannot be negative.\n");
return;
}
else if (page == 0)
{
CONS_Printf("There is no 0th page. (What are you a programmer?)\n");
return;
}
--page;
}
CONS_Printf("Total %d skins. Page (%d/%d)\n", numskins, page + 1, numpages);
// Find the longest name and realname in the skins list. (used for alignment)
for (i = page * 10; i < numskins && i < (page + 1) * 10; i++)
{
int length;
skin_t *skin = &skins[i];
if ((length = strlen(skin->name)) > longest_name)
longest_name = length;
}
for (i = page * 10; i < numskins && i < (page + 1) * 10; i++)
{
skin_t *skin = &skins[i];
CONS_Printf(
"%s[%-*s]\x80 %s\n",
HU_SkinColorToConsoleColor(skin->prefcolor),
longest_name,
skin->name,
skin->realname);
}
if (page + 1 != numpages)
{
CONS_Printf("Use \"listskins %d\" to see the next page.\n", page + 2);
}
else
{
CONS_Printf("There are no more pages.\n");
}
}
/** Sends a color change for the console player, unless that player is moving.
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
* \author Graue <graue@oceanbase.org>
+6
View File
@@ -150,6 +150,12 @@ extern consvar_t cv_pingtimeout;
extern consvar_t cv_showping;
extern consvar_t cv_pingmeasurement;
//extern consvar_t cv_smallpos;
extern consvar_t cv_showminimapnames;
extern consvar_t cv_minihead;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;
extern consvar_t cv_skipmapcheck;
+1 -1
View File
@@ -562,7 +562,7 @@ INT32 CL_CheckFiles(void)
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
// Check in already loaded files
for (j = mainwads+1; j < numwadfiles; j++)
for (j = mainwads+1; wadfiles[j]; j++)
{
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
if (!stricmp(wadfilename, fileneeded[i].filename) &&
+1
View File
@@ -8735,6 +8735,7 @@ struct {
// Custom client features exposed to lua
{"FEATURE_INTERMISSIONHUD",1},
{"FEATURE_VOTEHUD",1},
#endif
{NULL,0}
+2 -2
View File
@@ -149,8 +149,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v1 "
#define VERSIONSTRINGW L"Saturn v1"
#define VERSIONSTRING "Saturn v2 "
#define VERSIONSTRINGW L"Saturn v2"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
+63 -13
View File
@@ -545,8 +545,12 @@ static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0
consvar_t cv_gravstretch = {"gravstretch", "0", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t slamsound_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}};
consvar_t cv_slamsound = {"slamsound", "1", CV_SAVE, slamsound_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t sloperolldist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
@@ -5699,6 +5703,9 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
void G_WriteAllGhostTics(void)
{
UINT8 *save_demo_p = demo_p;
#define CHECKSPACE(num) if (demo_p+(num) > demoend) { demo_p = save_demo_p; G_CheckDemoStatus(); return; }
INT32 i, counter = leveltime;
for (i = 0; i < MAXPLAYERS; i++)
{
@@ -5713,10 +5720,16 @@ void G_WriteAllGhostTics(void)
if (counter % cv_netdemosyncquality.value != 0) // Only write 1 in this many ghost datas per tic to cut down on multiplayer replay size.
continue;
CHECKSPACE(1);
WRITEUINT8(demo_p, i);
G_WriteGhostTic(players[i].mo, i);
}
CHECKSPACE(1);
WRITEUINT8(demo_p, 0xFF);
#undef CHECKSPACE
}
void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
@@ -5727,6 +5740,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
UINT8 sprite;
UINT8 frame;
UINT8 *save_demo_p = demo_p;
#define CHECKSPACE(num) if (demo_p+(num) > demoend) { demo_p = save_demo_p; G_CheckDemoStatus(); return; }
if (!demo_p)
return;
if (!(demoflags & DF_GHOST))
@@ -5753,6 +5769,8 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
oldghost[playernum].y = ghost->y;
oldghost[playernum].z = ghost->z;
ziptic |= GZT_XYZ;
CHECKSPACE(sizeof(fixed_t)*3);
WRITEFIXED(demo_p,oldghost[playernum].x);
WRITEFIXED(demo_p,oldghost[playernum].y);
WRITEFIXED(demo_p,oldghost[playernum].z);
@@ -5769,6 +5787,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
oldghost[playernum].momx = momx;
oldghost[playernum].momy = momy;
ziptic |= GZT_MOMXY;
CHECKSPACE(4);
WRITEINT16(demo_p,momx);
WRITEINT16(demo_p,momy);
}
@@ -5777,6 +5798,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
{
oldghost[playernum].momz = momx;
ziptic |= GZT_MOMZ;
CHECKSPACE(2);
WRITEINT16(demo_p,momx);
}
@@ -5797,6 +5821,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
{
oldghost[playernum].angle = ghost->angle>>24;
ziptic |= GZT_ANGLE;
CHECKSPACE(1);
WRITEUINT8(demo_p,oldghost[playernum].angle);
}
@@ -5806,6 +5833,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
{
oldghost[playernum].frame = frame;
ziptic |= GZT_SPRITE;
CHECKSPACE(1);
WRITEUINT8(demo_p,oldghost[playernum].frame);
}
@@ -5845,20 +5875,26 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
if (ghostext[playernum].flags & EZT_COLOR)
{
CHECKSPACE(1);
WRITEUINT8(demo_p,ghostext[playernum].color);
ghostext[playernum].lastcolor = ghostext[playernum].color;
}
if (ghostext[playernum].flags & EZT_SCALE)
{
CHECKSPACE(sizeof(fixed_t));
WRITEFIXED(demo_p,ghostext[playernum].scale);
ghostext[playernum].lastscale = ghostext[playernum].scale;
}
if (ghostext[playernum].flags & EZT_HIT)
{
CHECKSPACE(2);
WRITEUINT16(demo_p,ghostext[playernum].hits);
for (i = 0; i < ghostext[playernum].hits; i++)
{
mobj_t *mo = ghostext[playernum].hitlist[i];
CHECKSPACE(4+4+2+sizeof(fixed_t)*3+sizeof(angle_t));
WRITEUINT32(demo_p,UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.)
WRITEUINT32(demo_p,mo->type);
WRITEUINT16(demo_p,(UINT16)mo->health);
@@ -5872,9 +5908,14 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
ghostext[playernum].hitlist = NULL;
}
if (ghostext[playernum].flags & EZT_SPRITE)
{
CHECKSPACE(1);
WRITEUINT8(demo_p,sprite);
}
if (ghostext[playernum].flags & EZT_KART)
{
CHECKSPACE(12);
WRITEINT32(demo_p, ghostext[playernum].kartitem);
WRITEINT32(demo_p, ghostext[playernum].kartamount);
WRITEINT32(demo_p, ghostext[playernum].kartbumpers);
@@ -5891,6 +5932,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
G_CheckDemoStatus(); // no more space
return;
}
#undef CHECKSPACE
}
void G_ConsAllGhostTics(void)
@@ -6743,22 +6785,30 @@ void G_RecordDemo(const char *name)
{
INT32 maxsize;
CONS_Printf("Recording demo %s.lmp\n", name);
strcpy(demoname, name);
strcat(demoname, ".lmp");
maxsize = cv_maxdemosize.value*1024*1024;
if (demobuffer)
free(demobuffer);
demo_p = NULL;
demo.recording = false;
demobuffer = malloc(maxsize);
demoend = demobuffer + maxsize;
if (demobuffer)
demo.recording = true;
else
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
free(demobuffer);
demobuffer = NULL;
demoend = NULL;
if (cv_recordmultiplayerdemos.value)
{
CONS_Printf("Recording demo %s.lmp\n", name);
strcpy(demoname, name);
strcat(demoname, ".lmp");
maxsize = cv_maxdemosize.value*1024*1024;
demobuffer = malloc(maxsize);
demoend = demobuffer + maxsize;
if (demobuffer)
demo.recording = true;
else
CONS_Alert(CONS_ERROR, "Failed to allocate demo buffer\n");
}
}
void G_RecordMetal(void)
+7
View File
@@ -145,11 +145,18 @@ extern consvar_t cv_mini_xoffset;
extern consvar_t cv_mini_yoffset;
extern consvar_t cv_want_xoffset;
extern consvar_t cv_want_yoffset;
extern consvar_t cv_showinput;
extern consvar_t cv_newspeedometer;
extern consvar_t cv_saltyhop;
extern consvar_t cv_saltyhopsfx;
extern consvar_t cv_saltysquish;
extern consvar_t cv_driftsparkpulse;
extern consvar_t cv_gravstretch;
extern consvar_t cv_sloperoll;
extern consvar_t cv_sliptideroll;
extern consvar_t cv_slamsound;
extern consvar_t cv_sloperolldist;
extern consvar_t cv_invincmusicfade;
+3 -1
View File
@@ -46,7 +46,9 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
//Hurdler: added for new development
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
+27 -25
View File
@@ -194,7 +194,7 @@ FTransform atransform;
// Float variants of viewx, viewy, viewz, etc.
static float gr_viewx, gr_viewy, gr_viewz;
static float gr_viewsin, gr_viewcos;
float gr_viewsin, gr_viewcos;
static fixed_t dup_viewx, dup_viewy, dup_viewz;
@@ -3755,7 +3755,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
}
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts)
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
{
if (cv_grspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
{
@@ -3907,7 +3907,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
}
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, baseWallVerts);
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
// push it toward the camera to mitigate floor-clipping sprites
{
@@ -4254,7 +4254,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// Let dispoffset work first since this adjust each vertex
// ...nah
HWR_RotateSpritePolyToAim(spr, wallVerts);
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
// push it toward the camera to mitigate floor-clipping sprites
{
@@ -4348,7 +4348,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
wallVerts[1].z = wallVerts[2].z = spr->z2;
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, wallVerts);
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = gpatch->max_s;
@@ -5074,6 +5074,7 @@ void HWR_ProjectSprite(mobj_t *thing)
spr_offset = rotsprite->leftoffset << FRACBITS;
spr_topoffset = rotsprite->topoffset << FRACBITS;
spr_topoffset += FEETADJUST;
// flip -> rotate, not rotate -> flip
flip = 0;
}
@@ -5129,13 +5130,13 @@ void HWR_ProjectSprite(mobj_t *thing)
if (thing->eflags & MFE_VERTICALFLIP)
{
gz = FIXED_TO_FLOAT(interp.z+thing->height) - FIXED_TO_FLOAT(spr_topoffset) * this_yscale;
gzt = gz + FIXED_TO_FLOAT(spr_height) * this_yscale;
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
}
else
{
gzt = FIXED_TO_FLOAT(interp.z) + FIXED_TO_FLOAT(spr_topoffset) * this_yscale;
gz = gzt - FIXED_TO_FLOAT(spr_height) * this_yscale;
gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale);
}
if (thing->subsector->sector->cullheight)
@@ -5177,10 +5178,10 @@ void HWR_ProjectSprite(mobj_t *thing)
vis->spriteyscale = spriteyscale;
vis->spritexoffset = FIXED_TO_FLOAT(spr_offset);
vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset);
//vis->patchlumpnum = sprframe->lumppat[rot];
#ifdef ROTSPRITE
if (rotsprite)
vis->gpatch = (GLPatch_t *)rotsprite;
vis->gpatch = (GLPatch_t *)rotsprite;
else
#endif
vis->gpatch = (GLPatch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
@@ -5252,11 +5253,11 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
unsigned rot = 0;
UINT8 flip;
// uncapped/interpolation
interpmobjstate_t interp = {0};
if (!thing)
return;
// uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
@@ -5325,16 +5326,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos;
// okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
//
// store information in a vissprite
//
@@ -5345,7 +5336,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->z2 = z2;
vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
//vis->patchlumpnum = sprframe->lumppat[rot];
vis->gpatch = (GLPatch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
vis->flip = flip;
vis->mobj = (mobj_t *)thing;
@@ -5364,6 +5354,16 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
vis->precip = true;
// okay... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
}
static boolean drewsky = false;
@@ -5815,6 +5815,8 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
if (skybox)
drewsky = true;
current_bsp_culling_distance = 0;
if (!skybox && cv_grrenderdistance.value)
{
HWD.pfnGClipRect((INT32)gr_viewwindowx,
+4
View File
@@ -45,6 +45,7 @@ extern unsigned msaa;
extern boolean a2c;
extern FTransform atransform;
extern float gr_viewsin, gr_viewcos;
// Performance stats
extern ps_metric_t ps_hw_nodesorttime;
@@ -97,6 +98,9 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
// Get amount of memory used by gpu textures in bytes
INT32 HWR_GetTextureUsed(void);
// hw_main.c: Post-rendering
void HWR_DoPostProcessor(player_t *player);
void HWR_StartScreenWipe(void);
+16 -8
View File
@@ -1144,7 +1144,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
spriteinfo_t *sprinfo;
INT32 rollfactor = 0;
angle_t ang;
float finalscale;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused)
@@ -1204,7 +1203,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
return;
}
}
finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
@@ -1386,18 +1384,28 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
}
#endif
// SRB2CBTODO: MD2 scaling support
finalscale *= FIXED_TO_FLOAT(interp.scale);
p.flip = atransform.flip;
#ifdef USE_FTRANSFORM_MIRROR
p.mirror = atransform.mirror; // from Kart
#endif
HWD.pfnSetShader(4); // model shader
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, &Surf);
{
float this_scale = FIXED_TO_FLOAT(interp.scale);
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
float ys = this_scale * FIXED_TO_FLOAT(interp.spriteyscale);
float ox = xs * FIXED_TO_FLOAT(interp.spritexoffset);
float oy = ys * FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, &Surf);
}
}
}
+8 -49
View File
@@ -3040,67 +3040,26 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
#define BUFFER_OFFSET(i) ((char*)(i))
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface)
static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
{
static GLRGBAFloat poly = {0,0,0,0};
static GLRGBAFloat tint = {0,0,0,0};
static GLRGBAFloat fade = {0,0,0,0};
const float radians = (float)(M_PIl / 180.0f);
float pol = 0.0f;
float scalex, scaley, scalez;
float sprxscale, spryscale;
float scalediffx, scalediffy;
int dfx, dfy;
float rollradian;
float scalecosx, scalesinx, scalecosy, scalesiny;
boolean useTinyFrames;
int i;
sprxscale = pos->spritexscale;
spryscale = pos->spriteyscale;
rollradian = 0;
rollradian = (pos->rollangle)*radians;
// Affect input model scaling
hscale *= 0.5f;
vscale *= 0.5f;
scalex = hscale;
scaley = vscale;
scalez = hscale;
// this is hilariously insane but it's late as fuck and I can't be inclined to care
scalediffx = (sprxscale*scale) - scale;
scalediffy = (spryscale*scale) - scale;
scale *= 0.5f;
sprxscale *= 1.5f;
spryscale *= 1.5f;
scalediffx *= 0.5f;
scalediffy *= 0.5f;
dfx = 1;
dfy = 1;
if (scalediffx < 0)
dfx = -1;
if (scalediffy < 0)
dfy = -1;
scalecosx = (fabs(scalediffx*cos(rollradian))*dfx);
scalesinx = (fabs(scalediffx*sin(rollradian))*dfx);
scalecosy = (fabs(scalediffy*sin(rollradian))*dfy);
scalesiny = (fabs(scalediffy*cos(rollradian))*dfy);
// "sprite accurate" model scaling, so that stretchy things don't look all that funky from any angle not the default
scalex = scale+scalecosx+scalecosy;
scaley = scale+scalesinx+scalesiny;
scalez = scale+scalecosx+scalecosy;
if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
{
float newtime = (duration - tics); // + 1;
@@ -3293,9 +3252,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
// -----------------+
// HWRAPI DrawModel : Draw a model
// -----------------+
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface)
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, FSurfaceInfo *Surface)
{
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, scale, flipped, Surface);
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, Surface);
}
// -----------------+
+133 -139
View File
@@ -81,6 +81,8 @@ patch_t *pingnum[10];
patch_t *pinggfx[5]; // small ping graphic
patch_t *pingmeasure[2]; // ping measurement graphic
patch_t *ranknum[10]; // rank numbers
patch_t *framecounter;
patch_t *frameslash; // framerate stuff. Used in screen.c
@@ -281,6 +283,8 @@ void HU_LoadGraphics(void)
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "PINGN%d", i);
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "OPPRNK0%d", i);
ranknum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
}
// minus for negative tallnums
@@ -682,6 +686,134 @@ static void Command_CSay_f(void)
}
static tic_t stop_spamming[MAXPLAYERS];
const char *HU_SkinColorToConsoleColor(skincolors_t color)
{
// Move this ugly switch into a function you can collapse.
switch (color)
{
case SKINCOLOR_WHITE:
case SKINCOLOR_SILVER:
case SKINCOLOR_SLATE:
return "\x80"; // White
case SKINCOLOR_GREY:
case SKINCOLOR_NICKEL:
case SKINCOLOR_BLACK:
case SKINCOLOR_SKUNK:
case SKINCOLOR_JET:
return "\x86"; // V_GRAYMAP
case SKINCOLOR_SEPIA:
case SKINCOLOR_BEIGE:
case SKINCOLOR_WALNUT:
case SKINCOLOR_BROWN:
case SKINCOLOR_LEATHER:
case SKINCOLOR_RUST:
case SKINCOLOR_WRISTWATCH:
return "\x8e"; // V_BROWNMAP
case SKINCOLOR_FAIRY:
case SKINCOLOR_SALMON:
case SKINCOLOR_PINK:
case SKINCOLOR_ROSE:
case SKINCOLOR_BRICK:
case SKINCOLOR_LEMONADE:
case SKINCOLOR_BUBBLEGUM:
case SKINCOLOR_LILAC:
return "\x8d"; // V_PINKMAP
case SKINCOLOR_CINNAMON:
case SKINCOLOR_RUBY:
case SKINCOLOR_RASPBERRY:
case SKINCOLOR_CHERRY:
case SKINCOLOR_RED:
case SKINCOLOR_CRIMSON:
case SKINCOLOR_MAROON:
case SKINCOLOR_FLAME:
case SKINCOLOR_SCARLET:
case SKINCOLOR_KETCHUP:
return "\x85"; // V_REDMAP
case SKINCOLOR_DAWN:
case SKINCOLOR_SUNSET:
case SKINCOLOR_CREAMSICLE:
case SKINCOLOR_ORANGE:
case SKINCOLOR_PUMPKIN:
case SKINCOLOR_ROSEWOOD:
case SKINCOLOR_BURGUNDY:
case SKINCOLOR_TANGERINE:
return "\x87"; // V_ORANGEMAP
case SKINCOLOR_PEACH:
case SKINCOLOR_CARAMEL:
case SKINCOLOR_CREAM:
return "\x8f"; // V_PEACHMAP
case SKINCOLOR_GOLD:
case SKINCOLOR_ROYAL:
case SKINCOLOR_BRONZE:
case SKINCOLOR_COPPER:
case SKINCOLOR_THUNDER:
return "\x8A"; // V_GOLDMAP
case SKINCOLOR_POPCORN:
case SKINCOLOR_QUARRY:
case SKINCOLOR_YELLOW:
case SKINCOLOR_MUSTARD:
case SKINCOLOR_CROCODILE:
case SKINCOLOR_OLIVE:
return "\x82"; // V_YELLOWMAP
case SKINCOLOR_ARTICHOKE:
case SKINCOLOR_VOMIT:
case SKINCOLOR_GARDEN:
case SKINCOLOR_TEA:
case SKINCOLOR_PISTACHIO:
return "\x8b"; // V_TEAMAP
case SKINCOLOR_LIME:
case SKINCOLOR_HANDHELD:
case SKINCOLOR_MOSS:
case SKINCOLOR_CAMOUFLAGE:
case SKINCOLOR_ROBOHOOD:
case SKINCOLOR_MINT:
case SKINCOLOR_GREEN:
case SKINCOLOR_PINETREE:
case SKINCOLOR_EMERALD:
case SKINCOLOR_SWAMP:
case SKINCOLOR_DREAM:
case SKINCOLOR_PLAGUE:
case SKINCOLOR_ALGAE:
return "\x83"; // V_GREENMAP
case SKINCOLOR_CARIBBEAN:
case SKINCOLOR_AZURE:
case SKINCOLOR_AQUA:
case SKINCOLOR_TEAL:
case SKINCOLOR_CYAN:
case SKINCOLOR_JAWZ:
case SKINCOLOR_CERULEAN:
case SKINCOLOR_NAVY:
case SKINCOLOR_SAPPHIRE:
return "\x88"; // V_SKYMAP
case SKINCOLOR_PIGEON:
case SKINCOLOR_PLATINUM:
case SKINCOLOR_STEEL:
return "\x8c"; // V_STEELMAP
case SKINCOLOR_PERIWINKLE:
case SKINCOLOR_BLUE:
case SKINCOLOR_BLUEBERRY:
case SKINCOLOR_NOVA:
return "\x84"; // V_BLUEMAP
case SKINCOLOR_ULTRAVIOLET:
case SKINCOLOR_PURPLE:
case SKINCOLOR_FUCHSIA:
return "\x81"; // V_PURPLEMAP
case SKINCOLOR_PASTEL:
case SKINCOLOR_MOONSLAM:
case SKINCOLOR_DUSK:
case SKINCOLOR_TOXIC:
case SKINCOLOR_MAUVE:
case SKINCOLOR_LAVENDER:
case SKINCOLOR_BYZANTIUM:
case SKINCOLOR_POMEGRANATE:
return "\x89"; // V_LAVENDERMAP
default:
return "\x83";
}
}
/** Receives a message, processing an ::XD_SAY command.
* \sa DoSayCommand
* \author Graue <graue@oceanbase.org>
@@ -828,145 +960,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
{
const UINT8 color = players[playernum].skincolor;
cstart = "\x83";
switch (color)
{
case SKINCOLOR_WHITE:
case SKINCOLOR_SILVER:
case SKINCOLOR_SLATE:
cstart = "\x80"; // White
break;
case SKINCOLOR_GREY:
case SKINCOLOR_NICKEL:
case SKINCOLOR_BLACK:
case SKINCOLOR_SKUNK:
case SKINCOLOR_JET:
cstart = "\x86"; // V_GRAYMAP
break;
case SKINCOLOR_SEPIA:
case SKINCOLOR_BEIGE:
case SKINCOLOR_WALNUT:
case SKINCOLOR_BROWN:
case SKINCOLOR_LEATHER:
case SKINCOLOR_RUST:
case SKINCOLOR_WRISTWATCH:
cstart = "\x8e"; // V_BROWNMAP
break;
case SKINCOLOR_FAIRY:
case SKINCOLOR_SALMON:
case SKINCOLOR_PINK:
case SKINCOLOR_ROSE:
case SKINCOLOR_BRICK:
case SKINCOLOR_LEMONADE:
case SKINCOLOR_BUBBLEGUM:
case SKINCOLOR_LILAC:
cstart = "\x8d"; // V_PINKMAP
break;
case SKINCOLOR_CINNAMON:
case SKINCOLOR_RUBY:
case SKINCOLOR_RASPBERRY:
case SKINCOLOR_CHERRY:
case SKINCOLOR_RED:
case SKINCOLOR_CRIMSON:
case SKINCOLOR_MAROON:
case SKINCOLOR_FLAME:
case SKINCOLOR_SCARLET:
case SKINCOLOR_KETCHUP:
cstart = "\x85"; // V_REDMAP
break;
case SKINCOLOR_DAWN:
case SKINCOLOR_SUNSET:
case SKINCOLOR_CREAMSICLE:
case SKINCOLOR_ORANGE:
case SKINCOLOR_PUMPKIN:
case SKINCOLOR_ROSEWOOD:
case SKINCOLOR_BURGUNDY:
case SKINCOLOR_TANGERINE:
cstart = "\x87"; // V_ORANGEMAP
break;
case SKINCOLOR_PEACH:
case SKINCOLOR_CARAMEL:
case SKINCOLOR_CREAM:
cstart = "\x8f"; // V_PEACHMAP
break;
case SKINCOLOR_GOLD:
case SKINCOLOR_ROYAL:
case SKINCOLOR_BRONZE:
case SKINCOLOR_COPPER:
case SKINCOLOR_THUNDER:
cstart = "\x8A"; // V_GOLDMAP
break;
case SKINCOLOR_POPCORN:
case SKINCOLOR_QUARRY:
case SKINCOLOR_YELLOW:
case SKINCOLOR_MUSTARD:
case SKINCOLOR_CROCODILE:
case SKINCOLOR_OLIVE:
cstart = "\x82"; // V_YELLOWMAP
break;
case SKINCOLOR_ARTICHOKE:
case SKINCOLOR_VOMIT:
case SKINCOLOR_GARDEN:
case SKINCOLOR_TEA:
case SKINCOLOR_PISTACHIO:
cstart = "\x8b"; // V_TEAMAP
break;
case SKINCOLOR_LIME:
case SKINCOLOR_HANDHELD:
case SKINCOLOR_MOSS:
case SKINCOLOR_CAMOUFLAGE:
case SKINCOLOR_ROBOHOOD:
case SKINCOLOR_MINT:
case SKINCOLOR_GREEN:
case SKINCOLOR_PINETREE:
case SKINCOLOR_EMERALD:
case SKINCOLOR_SWAMP:
case SKINCOLOR_DREAM:
case SKINCOLOR_PLAGUE:
case SKINCOLOR_ALGAE:
cstart = "\x83"; // V_GREENMAP
break;
case SKINCOLOR_CARIBBEAN:
case SKINCOLOR_AZURE:
case SKINCOLOR_AQUA:
case SKINCOLOR_TEAL:
case SKINCOLOR_CYAN:
case SKINCOLOR_JAWZ:
case SKINCOLOR_CERULEAN:
case SKINCOLOR_NAVY:
case SKINCOLOR_SAPPHIRE:
cstart = "\x88"; // V_SKYMAP
break;
case SKINCOLOR_PIGEON:
case SKINCOLOR_PLATINUM:
case SKINCOLOR_STEEL:
cstart = "\x8c"; // V_STEELMAP
break;
case SKINCOLOR_PERIWINKLE:
case SKINCOLOR_BLUE:
case SKINCOLOR_BLUEBERRY:
case SKINCOLOR_NOVA:
cstart = "\x84"; // V_BLUEMAP
break;
case SKINCOLOR_ULTRAVIOLET:
case SKINCOLOR_PURPLE:
case SKINCOLOR_FUCHSIA:
cstart = "\x81"; // V_PURPLEMAP
break;
case SKINCOLOR_PASTEL:
case SKINCOLOR_MOONSLAM:
case SKINCOLOR_DUSK:
case SKINCOLOR_TOXIC:
case SKINCOLOR_MAUVE:
case SKINCOLOR_LAVENDER:
case SKINCOLOR_BYZANTIUM:
case SKINCOLOR_POMEGRANATE:
cstart = "\x89"; // V_LAVENDERMAP
break;
default:
break;
}
cstart = HU_SkinColorToConsoleColor(color);
}
prefix = cstart;
+2
View File
@@ -83,6 +83,7 @@ extern patch_t *hu_font[HU_FONTSIZE], *kart_font[KART_FONTSIZE], *tny_font[HU_FO
extern patch_t *tallnum[10];
extern patch_t *pingnum[10];
extern patch_t *pinggfx[5];
extern patch_t *ranknum[10];
extern patch_t *nightsnum[10];
extern patch_t *framecounter;
extern patch_t *frameslash;
@@ -121,6 +122,7 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping draw
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
const char *HU_SkinColorToConsoleColor(skincolors_t color);
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
+182 -37
View File
@@ -22,6 +22,7 @@
#include "f_finale.h"
#include "lua_hud.h" // For Lua hud checks
#include "lua_hook.h" // For MobjDamage and ShouldDamage
#include "d_main.h" // found_extra_kart
// Hud offset cvars
consvar_t cv_item_xoffset = {"hud_item_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -53,6 +54,13 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0,
consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
// franticitems is Frantic Mode items, bool
@@ -3000,6 +3008,15 @@ static void K_StretchPlayerGravity(player_t *p)
I_Assert(p != NULL);
I_Assert(p->mo != NULL);
I_Assert(!P_MobjWasRemoved(p->mo));
if (p->mo->slamsoundtimer)
p->mo->slamsoundtimer--;
if (cv_slamsound.value == 1 && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer)
{
S_StartSound(p->mo, sfx_s3k4c);
p->mo->slamsoundtimer = TICRATE;
}
if (!P_IsObjectOnGround(p->mo))
{
@@ -3037,6 +3054,67 @@ static void K_StretchPlayerGravity(player_t *p)
}
}
static void K_QuiteSaltyHop(player_t *p)
{
// what the fuck is this haya
fixed_t mos = FRACUNIT; // doesnt work correctly if it isnt :/
// ready?
if (!p->kartstuff[k_jmp]) {
p->mo->salty_ready = true;
p->mo->salty_tapping = false;
} else if (p->mo->salty_ready) {
p->mo->salty_ready = false;
p->mo->salty_tapping = true;
} else {
p->mo->salty_tapping = false;
}
// GO!
if (!p->mo->init_salty) {
p->mo->salty_jump = false;
p->mo->salty_zoffset = 0;
p->mo->salty_momz = 0;
p->mo->init_salty = true;
}
else if ((p->mo->salty_jump)) {
if (p->mo->eflags & MFE_JUSTHITFLOOR) {
p->mo->salty_zoffset = 0;
} else if (P_IsObjectOnGround(p->mo)) {
p->mo->salty_zoffset += p->mo->salty_momz;
p->mo->salty_momz -= (mos*3/2);
} else {
p->mo->salty_zoffset *= (49/50)*mos;
p->mo->salty_momz = 0;
}
if (p->mo->salty_zoffset <= 0) {
if (!(p->mo->eflags & MFE_JUSTHITFLOOR) && P_IsObjectOnGround(p->mo) && cv_saltyhopsfx.value)
S_StartSound(p->mo, sfx_s268);
p->mo->salty_jump = false;
p->mo->salty_zoffset = 0;
p->mo->salty_momz = 0;
// shlamma damma
p->mo->stretchslam += cv_saltysquish.value ? (8*mos) : 0;
} else if (p->mo->salty_zoffset >= 0 && cv_saltysquish.value) {
// goofy ahh hack
p->mo->spriteyscale += (mos/8);
p->mo->spritexscale -= (mos/8);
}
p->mo->spriteyoffset = p->mo->salty_zoffset*P_MobjFlip(p->mo);
if (S_SoundPlaying(p->mo, sfx_screec))
S_StopSoundByID(p->mo, sfx_screec);
if (S_SoundPlaying(p->mo, sfx_drift))
S_StopSoundByID(p->mo, sfx_drift);
}
else if (p->mo->salty_tapping && P_IsObjectOnGround(p->mo) && !p->kartstuff[k_spinouttimer] && !p->kartstuff[k_squishedtimer]) {
p->mo->salty_jump = true;
p->mo->salty_zoffset = 0;
p->mo->salty_momz = 6*mos;
if (cv_saltyhopsfx.value)
S_StartSound(p->mo, sfx_s25a);
}
}
static INT32 K_FindPlayerNum(player_t *plyr)
{
INT32 i;
@@ -6392,6 +6470,16 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->kartstuff[k_boostcharge] = 0;
}
// salty hop! i wanna die
if (cv_saltyhop.value)
K_QuiteSaltyHop(player);
else {
player->mo->spriteyoffset = 0;
player->mo->salty_jump = false;
player->mo->salty_zoffset = 0;
player->mo->salty_momz = 0;
}
}
void K_CalculateBattleWanted(void)
@@ -6817,6 +6905,9 @@ static patch_t *kp_lapanim_hand[3];
static patch_t *kp_yougotem;
static patch_t *skp_smallsticker;
static patch_t *skp_speedpatches[5];
void K_LoadKartHUDGraphics(void)
{
INT32 i, j;
@@ -7063,6 +7154,16 @@ void K_LoadKartHUDGraphics(void)
}
kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX);
if (found_extra_kart) // snowy speedometer
{
skp_smallsticker = W_CachePatchName("SP_SMSTC", PU_HUDGFX);
skp_speedpatches[0] = W_CachePatchName("K_TRNULL", PU_HUDGFX); // lolxd
skp_speedpatches[1] = W_CachePatchName("SP_MKMH", PU_HUDGFX);
skp_speedpatches[2] = W_CachePatchName("SP_MMPH", PU_HUDGFX);
skp_speedpatches[3] = W_CachePatchName("SP_MFRAC", PU_HUDGFX);
skp_speedpatches[4] = W_CachePatchName("SP_MPERC", PU_HUDGFX);
}
}
// For the item toggle menu
@@ -7775,6 +7876,7 @@ static void K_DrawKartPositionNum(INT32 num)
patch_t *localpatch = kp_positionnum[0][0];
//INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
INT32 fx = 0, fy = 0, fflags = 0;
INT32 xoffs = (cv_showinput.value) ? -48 : 0;
boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun.
boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen.
boolean overtake = false;
@@ -7786,13 +7888,15 @@ static void K_DrawKartPositionNum(INT32 num)
}
if (splitscreen)
scale /= 2;
if (cv_showinput.value && !splitscreen) // anuther one.
scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
// pain and suffering defined below
if (!splitscreen)
{
fx = POSI_X;
fx = POSI_X + xoffs;
fy = BASEVIDHEIGHT - 8;
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
}
@@ -8202,35 +8306,62 @@ static void K_drawKartLaps(void)
static void K_drawKartSpeedometer(void)
{
fixed_t convSpeed;
// why?
if (cv_kartspeedometer.value == 0)
return;
fixed_t convSpeed = 0;
INT32 speedtype = 0;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
if (cv_kartspeedometer.value == 1) // Kilometers
switch (cv_kartspeedometer.value)
{
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed));
case 1:
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
speedtype = 1;
break;
case 2:
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
speedtype = 2;
break;
case 3:
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
speedtype = 3;
break;
case 4:
if (stplyr->mo)
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS;
speedtype = 4;
break;
default:
break;
}
else if (cv_kartspeedometer.value == 2) // Miles
// man.
if ((!cv_newspeedometer.value) || (cv_newspeedometer.value && !found_extra_kart))
{
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed));
}
else if (cv_kartspeedometer.value == 3) // Fracunits
{
convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
}
else if (cv_kartspeedometer.value == 4) // Percent
{
// so code breaks if someone attempts to join from spectator since it sets
// their mo to NULL
// so can we just check if their mo is NULL????
if (stplyr->mo)
{
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS;
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d P", convSpeed));
switch (speedtype) {
case 1:
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%03d km/h", convSpeed));
break;
case 2:
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%03d mph", convSpeed));
break;
case 3:
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%03d fu/t", convSpeed));
break;
case 4: // if extra.kart is found, use its included % symbol
if (!found_extra_kart)
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%03d P", convSpeed));
else
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%03d %%", convSpeed));
}
}
else if (cv_newspeedometer.value && found_extra_kart) { // why bother if we dont?
V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallsticker);
V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL);
V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]);
}
}
static void K_drawKartBumpersOrKarma(void)
@@ -8518,27 +8649,29 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (facemmapprefix[skin]->width/2))<<FRACBITS);
amypos = amnumypos + ((y + AutomapPic->height/2 - (facemmapprefix[skin]->height/2))<<FRACBITS);
// do we want this? it feels unnecessary. easier to just modify the amnumxpos?
/*if (encoremode)
{
flags |= V_FLIP;
amxpos = -amnumxpos + ((x + AutomapPic->width/2 + (facemmapprefix[skin]->width/2))<<FRACBITS);
}*/
if (!mo->color) // 'default' color
V_DrawSciencePatch(amxpos, amypos, flags, facemmapprefix[skin], FRACUNIT);
else
{
UINT8 *colormap;
if (mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
else
colormap = R_GetTranslationColormap(skin, mo->color, GTC_CACHE);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap);
UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE);
if (cv_minihead.value == 1)
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, facemmapprefix[skin], colormap);
else if (cv_minihead.value == 0)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap);
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4 * FRACUNIT), amypos - (3 * FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
if (mo->player
&& ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace)
|| (G_BattleGametype() && K_IsPlayerWanted(mo->player))))
{
if (cv_minihead.value == 1)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT / 2, flags, kp_wantedreticle, NULL);
else if (cv_minihead.value == 0)
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
}
}
@@ -9004,9 +9137,12 @@ static void K_drawKartFirstPerson(void)
// doesn't need to ever support 4p
static void K_drawInput(void)
{
if (!cv_showinput.value && !modeattacking) // dont bother
return;
static INT32 pn = 0;
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT);
INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col;
INT32 x = BASEVIDWIDTH - 32 + cv_posi_xoffset.value, y = BASEVIDHEIGHT-24 + cv_posi_yoffset.value, offs, col;
const INT32 accent1 = splitflags|colortranslations[stplyr->skincolor][5];
const INT32 accent2 = splitflags|colortranslations[stplyr->skincolor][9];
ticcmd_t *cmd = &stplyr->cmd;
@@ -9112,6 +9248,9 @@ static void K_drawChallengerScreen(void)
static void K_drawLapStartAnim(void)
{
if (! cv_showlapemblem.value)
return;
// This is an EVEN MORE insanely complicated animation.
const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation];
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE);
@@ -9388,6 +9527,12 @@ void K_drawKartHUD(void)
if (!stplyr->spectator && !demo.freecam) // Bottom of the screen elements, don't need in spectate mode
{
if (!(splitscreen || demo.title))
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position))
#endif
K_drawInput();
if (demo.title) // Draw title logo instead in demo.titles
{
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
+1
View File
@@ -44,5 +44,6 @@ boolean LUA_HudEnabled(enum hud option);
void LUAh_GameHUD(player_t *stplyr, huddrawlist_h list);
void LUAh_ScoresHUD(huddrawlist_h list);
void LUAh_IntermissionHUD(huddrawlist_h list);
void LUAh_VoteHUD(huddrawlist_h list);
#endif // __LUA_HUD_H__
+41 -3
View File
@@ -86,11 +86,13 @@ enum hudhook {
hudhook_game = 0,
hudhook_scores = 1,
hudhook_intermission = 2,
hudhook_vote = 3,
};
static const char *const hudhook_opt[] = {
"game",
"scores",
"intermission",
"vote",
NULL};
// alignment types for v.drawString
@@ -993,6 +995,9 @@ int LUA_HudLib(lua_State *L)
lua_newtable(L);
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
lua_newtable(L);
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
luaL_newmetatable(L, META_HUDINFO);
@@ -1061,7 +1066,7 @@ void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list)
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, 2); // HUD[2] = rendering funcs
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
@@ -1119,7 +1124,7 @@ void LUAh_ScoresHUD(huddrawlist_h list)
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, 3); // HUD[3] = rendering funcs
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
@@ -1152,7 +1157,40 @@ void LUAh_IntermissionHUD(huddrawlist_h list)
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
lua_pushnil(gL);
while (lua_next(gL, -3) != 0) {
lua_pushvalue(gL, -3); // graphics library (HUD[1])
LUA_Call(gL, 1, 0, 1);
}
lua_settop(gL, 0);
hud_running = false;
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
void LUAh_VoteHUD(huddrawlist_h list)
{
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
return;
lua_pushlightuserdata(gL, list);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
hud_running = true;
lua_settop(gL, 0);
lua_pushcfunction(gL, LUA_GetErrorMessage);
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
+3 -3
View File
@@ -84,7 +84,7 @@ huddrawlist_h LUA_HUD_CreateDrawList(void)
{
huddrawlist_h drawlist;
drawlist = (huddrawlist_h) Z_Calloc(sizeof(struct huddrawlist_s), PU_STATIC, NULL);
drawlist = (huddrawlist_h) Z_CallocAlign(sizeof(struct huddrawlist_s), PU_STATIC, NULL, 64);
drawlist->items = NULL;
drawlist->items_capacity = 0;
drawlist->items_len = 0;
@@ -145,7 +145,7 @@ static size_t AllocateDrawItem(huddrawlist_h list)
{
if (list->items_capacity == 0) list->items_capacity = 128;
else list->items_capacity *= 2;
list->items = (drawitem_t *) Z_Realloc(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL);
list->items = (drawitem_t *) Z_ReallocAlign(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL, 64);
}
return list->items_len++;
@@ -164,7 +164,7 @@ static size_t CopyString(huddrawlist_h list, const char* str)
{
if (list->strbuf_capacity == 0) list->strbuf_capacity = 256;
else list->strbuf_capacity *= 2;
list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL);
list->strbuf = (char*) Z_ReallocAlign(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL, 8);
}
{
+15 -12
View File
@@ -36,8 +36,8 @@ int mobj_snext_noset(lua_State *L);
int mobj_z_setter(lua_State *L);
int mobj_sprev_unimplemented(lua_State *L);
int mobj_angle_setter(lua_State *L);
//int mobj_sloperoll_noset(lua_State *L);
//int mobj_spritescale_setter(lua_State *L);
int mobj_sloperoll_noop(lua_State *L);
int mobj_spritescale_setter(lua_State *L);
int mobj_touching_sectorlist_unimplemented(lua_State *L);
int mobj_radius_setter(lua_State *L);
int mobj_height_setter(lua_State *L);
@@ -76,15 +76,15 @@ static const udata_field_t mobj_fields[] = {
FIELD(mobj_t, snext, udatalib_getter_mobj, mobj_snext_noset),
FIELD(mobj_t, sprev, mobj_sprev_unimplemented, mobj_sprev_unimplemented),
FIELD(mobj_t, angle, udatalib_getter_angle, mobj_angle_setter),
//FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
//FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noset),
FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle),
FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noop),
FIELD(mobj_t, sprite, udatalib_getter_spritenum, udatalib_setter_spritenum),
FIELD(mobj_t, frame, udatalib_getter_uint32, udatalib_setter_uint32),
FIELD(mobj_t, anim_duration, udatalib_getter_uint16, udatalib_setter_uint16),
//FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter),
//FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter),
//FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed),
//FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed),
FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter),
FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter),
FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed),
FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed),
FIELD(mobj_t, touching_sectorlist, mobj_touching_sectorlist_unimplemented, mobj_touching_sectorlist_unimplemented),
FIELD(mobj_t, subsector, udatalib_getter_subsector, mobj_nosetpos_subsector),
FIELD(mobj_t, floorz, udatalib_getter_fixed, mobj_nosetpos_floorz),
@@ -133,7 +133,7 @@ static const udata_field_t mobj_fields[] = {
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
//FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
{ NULL },
};
#undef FIELD
@@ -174,7 +174,6 @@ int mobj_ ## field ## _noset(lua_State *L) \
return luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly.", #field); \
}
//NOSET(sloperoll)
NOSET(snext)
NOSET(bnext)
NOSET(info)
@@ -198,6 +197,10 @@ UNIMPLEMENTED(mobjnum)
#undef UNIMPLEMENTED
// For some dumb reason it is valid to set sloperoll, even though it is read
// only
int mobj_sloperoll_noop(lua_State *L) { return 0; }
// Now other getters/setters with arbitary logic
// Getters get light userdata, which in this case is just mobj_t pointer
@@ -233,7 +236,7 @@ int mobj_angle_setter(lua_State *L)
return 0;
}
/*int mobj_spritescale_setter(lua_State *L)
int mobj_spritescale_setter(lua_State *L)
{
mobj_t *mo = GETMO();
@@ -251,7 +254,7 @@ int mobj_angle_setter(lua_State *L)
mo->realyscale = luaL_checkfixed(L, 2);
}
return 0;
}*/
}
int mobj_radius_setter(lua_State *L)
{
+2
View File
@@ -516,7 +516,9 @@ static int player_get(lua_State *L)
}
lua_getfield(L, -1, field);
if (lua_isnil(L, -1)) // no value for this field
{
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "player_t", field);
}
return 1;
}
+1 -1
View File
@@ -87,7 +87,7 @@ int udatalib_setter_boolean_nocheck(lua_State *L)
UDATALIB_SIMPLE_SETTER(boolean, lua_toboolean)
int udatalib_setter_spritenum(lua_State *L)
UDATALIB_SIMPLE_SETTER(spritenum_t, (spritenum_t)luaL_checkinteger)
UDATALIB_SIMPLE_SETTER(spritenum_t, luaL_checkinteger)
int udatalib_setter_tic(lua_State *L)
UDATALIB_SIMPLE_SETTER(tic_t, (tic_t)luaL_checkinteger)
+3 -5
View File
@@ -1,8 +1,6 @@
#ifndef __LUA_UDATALIB_H__
#define __LUA_UDATALIB_H__
#include <stdint.h>
#ifdef HAVE_BLUA
#include "doomdef.h"
@@ -16,7 +14,7 @@
typedef struct udata_field_s {
const char *name;
intptr_t offset;
size_t offset;
lua_CFunction getter;
lua_CFunction setter;
} udata_field_t;
@@ -82,8 +80,8 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
// Get pointer to field value within getter or setter
#define UDATALIB_GETFIELD(type, field) \
{ \
intptr_t offset = lua_tointeger(L, lua_upvalueindex(1)); \
field = (type*)((intptr_t)lua_touserdata(L, 1) + offset); \
size_t offset = lua_tointeger(L, lua_upvalueindex(1)); \
field = (type*)((uint8_t*)lua_touserdata(L, 1) + offset); \
}
// Creates implementation for simple getter and setter. Super lazy, yes.
+63 -22
View File
@@ -1694,14 +1694,34 @@ static menuitem_t OP_MonitorToggleMenu[] =
static menuitem_t OP_SaturnMenu[] =
{
{IT_HEADER, NULL, "Saturn Options", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 30},
//{IT_STRING | IT_CVAR, NULL, "Addon Download Speed", &cv_downloadspeed, 55}, //no idea why you would wanna change it anyways
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 50},
{IT_STRING | IT_CVAR, NULL, "No Midnight Channel Flicker", &cv_lessflicker, 75},
{IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 100},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 115},
{IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 20},
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 40},
{IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 50},
{IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 60},
{IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 70},
{IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 80},
{IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 90},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110},
{IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 130},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 145},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 155}, // uwu
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu
};
enum
{
sm_header,
sm_waittime,
sm_skinselspeed,
sm_input,
sm_speedometer,
sm_lapemblem,
sm_mapnames,
sm_smallmap,
sm_pisschannel,
sm_distortionmenu,
sm_hudoffsets,
sm_credits,
};
static menuitem_t OP_PlayerDistortMenu[] =
@@ -1712,6 +1732,10 @@ static menuitem_t OP_PlayerDistortMenu[] =
{IT_STRING | IT_CVAR, NULL, "Slope rotation distance", &cv_sloperolldist, 35},
{IT_STRING | IT_CVAR, NULL, "Rotate players when sliptiding", &cv_sliptideroll, 50},
{IT_STRING | IT_CVAR, NULL, "Player stretch factor", &cv_gravstretch, 65},
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 80},
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 110},
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 125},
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140},
};
enum
@@ -1745,25 +1769,27 @@ static menuitem_t OP_SaturnCreditsMenu[] =
{IT_HEADER, NULL, "Main Devs <3", NULL, 20},
{IT_STRING, NULL, "alufolie91 aka Alug", NULL, 30},
{IT_STRING, NULL, "Indev", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "alufolie91 aka Alug", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 40},
{IT_HEADER, NULL, "Testers <3", NULL, 60},
{IT_STRING, NULL, "Sunflower aka AnimeSonic", NULL, 70},
{IT_STRING, NULL, "Yuz aka Yuzler", NULL, 80},
{IT_STRING, NULL, "Democrab", NULL, 90},
{IT_STRING, NULL, "EXpand aka Maver", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "EXpand aka Maver", NULL, 100},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 120},
{IT_STRING, NULL, "xyzzy", NULL, 130},
{IT_STRING, NULL, "Haya", NULL, 140},
{IT_STRING, NULL, "Galactice", NULL, 150},
{IT_STRING, NULL, "Himie and", NULL, 160},
{IT_STRING, NULL, "The Moe Mansion / Birdhouse Team", NULL, 170},
{IT_STRING, NULL, "All of Sunflower's Garden", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Galactice", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "Himie and", NULL, 160},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion / Birdhouse Team", NULL, 170},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 180},
{IT_STRING+IT_SPACE, NULL, "", NULL, 190}, // dummy text
{IT_STRING, NULL, "", NULL, 200}, // dummy text II
};
static menuitem_t OP_BirdMenu[] =
@@ -2340,8 +2366,8 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_
#endif
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30);
menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30);
menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 60);
menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 15);
menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30);
menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 20);
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10);
@@ -3437,6 +3463,18 @@ void M_Drawer(void)
#else // Regular build
V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
#endif
#ifdef HWRENDER
if (rendermode == render_opengl)
{
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
}
#endif
if (rendermode == render_soft)
{
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
}
}
}
}
@@ -3826,6 +3864,9 @@ void M_Init(void)
OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED;
#endif
if (!found_extra_kart) // why bother?
OP_SaturnMenu[sm_speedometer].status = IT_GRAYEDOUT;
#ifndef NONET
CV_RegisterVar(&cv_serversort);
#endif
@@ -11050,7 +11091,7 @@ static void M_DrawJoystick(void)
compareval4 = cv_usejoystick4.value;
compareval3 = cv_usejoystick3.value;
compareval2 = cv_usejoystick2.value;
compareval = cv_usejoystick.value
compareval = cv_usejoystick.value;
#endif
if ((setupcontrolplayer == 4 && (i == compareval4))
+1 -1
View File
@@ -114,7 +114,7 @@ fixed_t P_RandomFixedD(const char *rfile, INT32 rline)
{
CONS_Printf("P_RandomFixed() at: %sp %d\n", rfile, rline);
#endif
return (INT32)((INT64)__internal_prng__());
return __internal_prng__();
}
/** Provides a random byte. Distribution is uniform.
+14 -13
View File
@@ -3792,12 +3792,11 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
{
//(void)mobj;
mobj->precipflags &= ~PCF_THUNK;
R_ResetPrecipitationMobjInterpolationState(mobj);
}
void P_SnowThinker(precipmobj_t *mobj)
{
R_ResetPrecipitationMobjInterpolationState(mobj);
P_CycleStateAnimation((mobj_t *)mobj);
// adjust height
@@ -3810,8 +3809,6 @@ void P_SnowThinker(precipmobj_t *mobj)
void P_RainThinker(precipmobj_t *mobj)
{
R_ResetPrecipitationMobjInterpolationState(mobj);
P_CycleStateAnimation((mobj_t *)mobj);
if (mobj->state != &states[S_RAIN1])
@@ -3838,17 +3835,18 @@ void P_RainThinker(precipmobj_t *mobj)
}
// adjust height
if ((mobj->z += mobj->momz) <= mobj->floorz)
if ((mobj->z += mobj->momz) > mobj->floorz)
return;
// no splashes on sky or bottomless pits
if (mobj->precipflags & PCF_PIT)
{
// no splashes on sky or bottomless pits
if (mobj->precipflags & PCF_PIT)
mobj->z = mobj->ceilingz;
else
{
mobj->z = mobj->floorz;
P_SetPrecipMobjState(mobj, S_SPLASH1);
}
mobj->z = mobj->ceilingz;
return;
}
mobj->z = mobj->floorz;
P_SetPrecipMobjState(mobj, S_SPLASH1);
}
static void P_RingThinker(mobj_t *mobj)
@@ -9564,6 +9562,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->spriteyscale = mobj->realyscale;
mobj->spritexoffset = mobj->spriteyoffset = 0;
// Funni slam sound when landing
mobj->slamsoundtimer = 0;
// set subsector and/or block links
P_SetThingPosition(mobj);
I_Assert(mobj->subsector != NULL);
+11
View File
@@ -23,6 +23,7 @@
// We need the WAD data structure for Map things, from the THINGS lump.
#include "doomdata.h"
#include "doomtype.h"
// States are tied to finite states are tied to animation frames.
// Needs precompiled tables/data structures.
@@ -394,6 +395,16 @@ typedef struct mobj_s
boolean colorized; // Whether the mobj uses the rainbow colormap
boolean rollmodel; // OpenGL: Should this model rotate?
tic_t slamsoundtimer;
// saltyhop! hardcode edition
boolean salty_ready;
boolean salty_tapping;
fixed_t salty_zoffset;
fixed_t salty_momz;
boolean salty_jump;
boolean init_salty;
// WARNING: New fields must be added separately to savegame and Lua.
} mobj_t;
+1
View File
@@ -1984,6 +1984,7 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->spritexscale = mobj->spriteyscale = mobj->old_spritexscale = mobj->old_spriteyscale = FRACUNIT;
mobj->realxscale = mobj->realyscale = FRACUNIT;
mobj->stretchslam = 0;
mobj->slamsoundtimer = 0;
mobj->sloperoll = mobj->reservezangle = mobj->reservexydir = 0;
+13 -8
View File
@@ -298,8 +298,8 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
// Sprite offsets are not interpolated until we have a way to interpolate them explicitly in Lua.
// It seems existing mods visually break more often than not if it is interpolated.
out->spritexoffset = mobj->spritexoffset;
out->spriteyoffset = mobj->spriteyoffset;
//out->spritexoffset = mobj->spritexoffset;
//out->spriteyoffset = mobj->spriteyoffset;
out->subsector = R_PointInSubsector(out->x, out->y);
@@ -357,11 +357,12 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
levelinterpolators_size *= 2;
}
levelinterpolators = Z_Realloc(
levelinterpolators = Z_ReallocAlign(
(void*) levelinterpolators,
sizeof(levelinterpolator_t*) * levelinterpolators_size,
PU_LEVEL,
NULL
NULL,
sizeof(levelinterpolator_t*) * 8
);
}
@@ -371,8 +372,11 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
static levelinterpolator_t *CreateInterpolator(levelinterpolator_type_e type, thinker_t *thinker)
{
levelinterpolator_t *ret = (levelinterpolator_t*) Z_Calloc(
sizeof(levelinterpolator_t), PU_LEVEL, NULL
levelinterpolator_t *ret = (levelinterpolator_t*) Z_CallocAlign(
sizeof(levelinterpolator_t),
PU_LEVEL,
NULL,
sizeof(levelinterpolator_t) * 8
);
ret->type = type;
@@ -687,11 +691,12 @@ void R_AddMobjInterpolator(mobj_t *mobj)
interpolated_mobjs_capacity *= 2;
}
interpolated_mobjs = Z_Realloc(
interpolated_mobjs = Z_ReallocAlign(
interpolated_mobjs,
sizeof(mobj_t *) * interpolated_mobjs_capacity,
PU_LEVEL,
NULL
NULL,
64
);
}
+1
View File
@@ -160,6 +160,7 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"},
{0, "None"}, {0, NULL}};
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
+13 -12
View File
@@ -1796,17 +1796,6 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
return;
}
// okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
//SoM: 3/17/2000: Disregard sprites that are out of view..
gzt = interp.z + spritecachedinfo[lump].topoffset;
gz = gzt - spritecachedinfo[lump].height;
@@ -1814,7 +1803,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
if (thing->subsector->sector->cullheight)
{
if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt))
return;
goto weatherthink;
}
// store information in a vissprite
@@ -1878,6 +1867,18 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->precip = true;
vis->vflip = false;
vis->isScaled = false;
weatherthink:
// okay... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
}
// R_AddSprites
-5
View File
@@ -138,11 +138,6 @@ typedef struct vissprite_s
angle_t centerangle; // for paper sprites
struct {
fixed_t tan; // The amount to shear the sprite vertically per row
INT32 offset; // The center of the shearing location offset from x1
} shear;
fixed_t texturemid;
patch_t *patch;
+61 -17
View File
@@ -54,6 +54,7 @@ static void SetChannelsNum(void);
static void Command_Tunes_f(void);
static void Command_RestartAudio_f(void);
static void Command_RestartMusic_f(void); //mhhhm amiga type filters here i come uwu
static void Command_ShowMusicCredit_f(void);
// Sound system toggles
#ifndef NO_MIDI
@@ -154,7 +155,7 @@ consvar_t cv_amigafilter = {"amigafilter", "1", CV_SAVE|CV_CALL, amigafilter_con
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
static CV_PossibleValue_t amigatype_cons_t[] = {{0, "auto"}, {1, "a500"}, {2, "a1200"}, {0, NULL}};
consvar_t cv_amigatype = {"amigatype", "0", CV_SAVE|CV_CALL, amigatype_cons_t, AmigaType_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_amigatype = {"amigatype", "0", CV_SAVE|CV_CALL|CV_NOINIT, amigatype_cons_t, AmigaType_OnChange, 0, NULL, NULL, 0, 0, NULL};
#endif
#endif
@@ -322,6 +323,7 @@ void S_RegisterSoundStuff(void)
COM_AddCommand("tunes", Command_Tunes_f);
COM_AddCommand("restartaudio", Command_RestartAudio_f);
COM_AddCommand("restartmusic", Command_RestartMusic_f);
COM_AddCommand("showmusiccredit", Command_ShowMusicCredit_f);
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
@@ -1514,6 +1516,32 @@ void S_InitMusicDefs(void)
S_LoadMusicDefs(i);
}
//
// S_FindMusicCredit
//
// Returns musicdef of specified song, or null if musicdef for it doesn't exist
//
musicdef_t *S_FindMusicCredit(const char *musname)
{
musicdef_t *def = musicdefstart;
if (!def) // No definitions
return NULL;
while (def)
{
if (!stricmp(def->name, musname))
{
return def;
}
else
def = def->next;
}
return NULL;
}
//
// S_ShowSpecifiedMusicCredit
//
@@ -1521,26 +1549,21 @@ void S_InitMusicDefs(void)
//
void S_ShowSpecifiedMusicCredit(const char *musname)
{
musicdef_t *def = musicdefstart;
musicdef_t *def;
if (digital_disabled) return;
if (!cv_songcredits.value || demo.rewinding)
return;
if (!def) // No definitions
return;
def = S_FindMusicCredit(musname);
while (def)
if (def)
{
if (!stricmp(def->name, musname))
{
cursongcredit.def = def;
cursongcredit.anim = 5*TICRATE;
cursongcredit.x = 0;
cursongcredit.trans = NUMTRANSMAPS;
return;
}
else
def = def->next;
cursongcredit.def = def;
cursongcredit.anim = 5*TICRATE;
cursongcredit.x = 0;
cursongcredit.trans = NUMTRANSMAPS;
}
}
@@ -2175,6 +2198,26 @@ static void Command_RestartMusic_f(void) //same as RestartAudio but only music g
S_RestartMusic();
}
static void Command_ShowMusicCredit_f(void)
{
const char *musname = music_name;
if (COM_Argc() > 1)
{
musname = COM_Argv(1);
}
else
{
S_ShowMusicCredit();
}
musicdef_t *def = S_FindMusicCredit(musname);
if (def) {
CONS_Printf("%.6s - %.255s\n", musname, def->source);
}
}
void GameSounds_OnChange(void)
{
if (M_CheckParm("-nosound") || M_CheckParm("-noaudio"))
@@ -2257,9 +2300,10 @@ void AmigaFilter_OnChange(void)
void AmigaType_OnChange(void)
{
if (openmpt_mhandle)
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigatype.string);
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
S_RestartMusic(); //need to restart the music system or else it wont work
if (sound_started)
S_RestartMusic(); //need to restart the music system or else it wont work
}
#endif
#endif
+1
View File
@@ -172,6 +172,7 @@ extern musicdef_t *musicdefstart;
void S_LoadMusicDefs(UINT16 wadnum);
void S_InitMusicDefs(void);
musicdef_t *S_FindMusicCredit(const char *musname);
void S_ShowSpecifiedMusicCredit(const char *musname);
void S_ShowMusicCredit(void);
+4 -2
View File
@@ -137,10 +137,12 @@ void SCR_SetMode(void)
{
if (R_MMX)
{
colfunc = basecolfunc = R_DrawColumn_8_MMX;
//colfunc = basecolfunc = R_DrawColumn_8_MMX; Can we please not use this function it seems to break sometimes????
colfunc = basecolfunc = R_DrawColumn_8_ASM;
//shadecolfunc = R_DrawShadeColumn_8_ASM;
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
walldrawerfunc = R_DrawWallColumn_8_MMX;
//walldrawerfunc = R_DrawWallColumn_8_MMX; This is just an alias to R_DrawColumn_8_MMX
walldrawerfunc = R_DrawWallColumn_8_ASM;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
spanfunc = basespanfunc = R_DrawSpan_8_MMX;
}
+5
View File
@@ -2059,8 +2059,13 @@ void I_StartupGraphics(void)
#endif
if (rendermode == render_none)
{
#ifdef HWRENDER
rendermode = render_opengl;
CONS_Printf("Defaulting to OpenGL renderer.\n");
#else
rendermode = render_soft;
CONS_Printf("Using default software renderer.\n");
#endif
}
}
+6 -5
View File
@@ -121,12 +121,11 @@ static UINT16 current_track;
#endif
#ifdef HAVE_OPENMPT
static openmpt_module *mod = 0;
int mod_err = OPENMPT_ERROR_OK;
static int mod_err = OPENMPT_ERROR_OK;
static const char *mod_err_str;
static UINT16 current_subsong;
size_t probesize;
int result;
static size_t probesize;
static int result;
#endif
static void var_cleanup(void)
@@ -1137,7 +1136,7 @@ boolean I_LoadSong(char *data, size_t len)
#ifdef HAVE_OPENMPT
/*
If the size of the data to be checked is bigger than the recommended size (> 2048)
If the size of the data to be checked is bigger than the recommended size (> 2048 bytes)
Let's just set the probe size to the recommended size
Otherwise let's give it the full data size
*/
@@ -1421,6 +1420,8 @@ boolean I_SetSongTrack(int track)
return false;
}
#endif
if (I_SongType() == MU_MOD)
return !Mix_SetMusicPosition(track);
(void)track;
return false;
}
+286 -1
View File
@@ -73,7 +73,7 @@ consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons
//static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
// console variables in development
consvar_t cv_grmdls = {"gr_mdls", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1770,6 +1770,12 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
}
}
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option)/2;
V_DrawSmallString(x, y, option, string);
}
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option);
@@ -1983,6 +1989,102 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
}
}
// Jaden: awesome!
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
fixed_t cx = x, cy = y;
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
const char *ch = string;
INT32 charflags = 0;
const UINT8 *colormap = NULL;
INT32 spacewidth = 2, charwidth = 0;
INT32 lowercase = (option & V_ALLOWLOWERCASE);
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
if (option & V_NOSCALESTART)
{
dupx = vid.dupx;
dupy = vid.dupy;
scrwidth = vid.width;
}
else
{
dupx = dupy = 1;
scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
}
if (option & V_NOSCALEPATCH)
scrwidth *= vid.dupx;
charflags = (option & V_CHARCOLORMASK);
switch (option & V_SPACINGMASK)
{
case V_MONOSPACE:
spacewidth = 4;
/* FALLTHRU */
case V_OLDSPACING:
charwidth = 4;
break;
case V_6WIDTHSPACE:
spacewidth = 3;
default:
break;
}
for (;;ch++)
{
if (!*ch)
break;
if (*ch & 0x80) //color parsing -x 2.16.09
{
// manually set flags override color codes
if (!(option & V_CHARCOLORMASK))
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
continue;
}
if (*ch == '\n')
{
cx = x;
if (option & V_RETURN8)
cy += (4*dupy)<<FRACBITS;
else
cy += (6*dupy)<<FRACBITS;
continue;
}
c = *ch;
if (!lowercase)
c = toupper(c);
c -= HU_FONTSTART;
// character does not exist or is a space
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
{
cx += (spacewidth * dupx)<<FRACBITS;
continue;
}
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - hu_font[c]->width*(dupx/4);
}
else
w = hu_font[c]->width * dupx / 2;
if ((cx>>FRACBITS) > scrwidth)
break;
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
{
cx += w<<FRACBITS;
continue;
}
colormap = V_GetStringColormap(charflags);
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT/2, option, hu_font[c], colormap);
cx += w<<FRACBITS;
}
}
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
x -= (V_SmallStringWidth(string, option) / 2)<<FRACBITS;
V_DrawSmallStringAtFixed(x, y, option, string);
}
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
{
@@ -2053,6 +2155,28 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
return x;
}
// Jaden: Draw a number using the position numbers.
//
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap)
{
INT32 w = SHORT(ranknum[0]->width) - 1;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
if (num < 0)
num = -num;
// draw the number
do
{
x -= (w - 1);
V_DrawFixedPatch(x << FRACBITS, y << FRACBITS, FRACUNIT, flags, ranknum[num % 10], colormap);
num /= 10;
} while (--digits);
}
// Write a string using the credit font
// NOTE: the text is centered for screens larger than the base width
//
@@ -2347,6 +2471,167 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
return w;
}
char V_GetSkincolorChar(INT32 color)
{
char cstart = 0x80;
switch (color)
{
case SKINCOLOR_WHITE:
case SKINCOLOR_SILVER:
case SKINCOLOR_SLATE:
cstart = 0x80; // White
break;
case SKINCOLOR_GREY:
case SKINCOLOR_NICKEL:
case SKINCOLOR_BLACK:
case SKINCOLOR_SKUNK:
case SKINCOLOR_JET:
cstart = 0x86; // V_GRAYMAP
break;
case SKINCOLOR_SEPIA:
case SKINCOLOR_BEIGE:
case SKINCOLOR_WALNUT:
case SKINCOLOR_BROWN:
case SKINCOLOR_LEATHER:
case SKINCOLOR_RUST:
case SKINCOLOR_WRISTWATCH:
cstart = 0x8e; // V_BROWNMAP
break;
case SKINCOLOR_FAIRY:
case SKINCOLOR_SALMON:
case SKINCOLOR_PINK:
case SKINCOLOR_ROSE:
case SKINCOLOR_BRICK:
case SKINCOLOR_LEMONADE:
case SKINCOLOR_BUBBLEGUM:
case SKINCOLOR_LILAC:
cstart = 0x8d; // V_PINKMAP
break;
case SKINCOLOR_CINNAMON:
case SKINCOLOR_RUBY:
case SKINCOLOR_RASPBERRY:
case SKINCOLOR_CHERRY:
case SKINCOLOR_RED:
case SKINCOLOR_CRIMSON:
case SKINCOLOR_MAROON:
case SKINCOLOR_FLAME:
case SKINCOLOR_SCARLET:
case SKINCOLOR_KETCHUP:
cstart = 0x85; // V_REDMAP
break;
case SKINCOLOR_DAWN:
case SKINCOLOR_SUNSET:
case SKINCOLOR_CREAMSICLE:
case SKINCOLOR_ORANGE:
case SKINCOLOR_PUMPKIN:
case SKINCOLOR_ROSEWOOD:
case SKINCOLOR_BURGUNDY:
case SKINCOLOR_TANGERINE:
cstart = 0x87; // V_ORANGEMAP
break;
case SKINCOLOR_PEACH:
case SKINCOLOR_CARAMEL:
case SKINCOLOR_CREAM:
cstart = 0x8f; // V_PEACHMAP
break;
case SKINCOLOR_GOLD:
case SKINCOLOR_ROYAL:
case SKINCOLOR_BRONZE:
case SKINCOLOR_COPPER:
case SKINCOLOR_THUNDER:
cstart = 0x8a; // V_GOLDMAP
break;
case SKINCOLOR_POPCORN:
case SKINCOLOR_QUARRY:
case SKINCOLOR_YELLOW:
case SKINCOLOR_MUSTARD:
case SKINCOLOR_CROCODILE:
case SKINCOLOR_OLIVE:
cstart = 0x82; // V_YELLOWMAP
break;
case SKINCOLOR_ARTICHOKE:
case SKINCOLOR_VOMIT:
case SKINCOLOR_GARDEN:
case SKINCOLOR_TEA:
case SKINCOLOR_PISTACHIO:
cstart = 0x8b; // V_TEAMAP
break;
case SKINCOLOR_LIME:
case SKINCOLOR_HANDHELD:
case SKINCOLOR_MOSS:
case SKINCOLOR_CAMOUFLAGE:
case SKINCOLOR_ROBOHOOD:
case SKINCOLOR_MINT:
case SKINCOLOR_GREEN:
case SKINCOLOR_PINETREE:
case SKINCOLOR_EMERALD:
case SKINCOLOR_SWAMP:
case SKINCOLOR_DREAM:
case SKINCOLOR_PLAGUE:
case SKINCOLOR_ALGAE:
cstart = 0x83; // V_GREENMAP
break;
case SKINCOLOR_CARIBBEAN:
case SKINCOLOR_AZURE:
case SKINCOLOR_AQUA:
case SKINCOLOR_TEAL:
case SKINCOLOR_CYAN:
case SKINCOLOR_JAWZ:
case SKINCOLOR_CERULEAN:
case SKINCOLOR_NAVY:
case SKINCOLOR_SAPPHIRE:
cstart = 0x88; // V_SKYMAP
break;
case SKINCOLOR_PIGEON:
case SKINCOLOR_PLATINUM:
case SKINCOLOR_STEEL:
cstart = 0x8c; // V_STEELMAP
break;
case SKINCOLOR_PERIWINKLE:
case SKINCOLOR_BLUE:
case SKINCOLOR_BLUEBERRY:
case SKINCOLOR_NOVA:
cstart = 0x84; // V_BLUEMAP
break;
case SKINCOLOR_ULTRAVIOLET:
case SKINCOLOR_PURPLE:
case SKINCOLOR_FUCHSIA:
cstart = 0x81; // V_PURPLEMAP
break;
case SKINCOLOR_PASTEL:
case SKINCOLOR_MOONSLAM:
case SKINCOLOR_DUSK:
case SKINCOLOR_TOXIC:
case SKINCOLOR_MAUVE:
case SKINCOLOR_LAVENDER:
case SKINCOLOR_BYZANTIUM:
case SKINCOLOR_POMEGRANATE:
cstart = 0x89; // V_LAVENDERMAP
break;
default:
break;
}
return cstart;
}
boolean *heatshifter = NULL;
INT32 lastheight = 0;
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
+9
View File
@@ -191,6 +191,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
// draw a string using the hu_font, 0.5x scale
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
// draw a string using the tny_font
@@ -200,6 +201,9 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
// Draw tall nums, used for menu, HUD, intermission
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
@@ -212,6 +216,9 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
INT32 V_LevelNameWidth(const char *string);
INT32 V_LevelNameHeight(const char *string);
// Rank numbers.
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap);
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
INT32 V_CreditStringWidth(const char *string);
@@ -222,6 +229,8 @@ INT32 V_SmallStringWidth(const char *string, INT32 option);
// Find string width from tny_font chars
INT32 V_ThinStringWidth(const char *string, INT32 option);
char V_GetSkincolorChar(INT32 color);
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
void V_DrawPatchFill(patch_t *pat);
+24 -9
View File
@@ -121,6 +121,7 @@ intertype_t intertype = int_none;
#ifdef HAVE_BLUA
static huddrawlist_h luahuddrawlist_intermission = NULL;
static huddrawlist_h luahuddrawlist_vote = NULL;
#endif
static void Y_FollowIntermission(void);
@@ -366,15 +367,6 @@ void Y_IntermissionDrawer(void)
if (usebuffer) // Fade everything out
V_DrawFadeScreen(0xFF00, 22);
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
LUAh_IntermissionHUD(luahuddrawlist_intermission);
}
LUA_HUD_DrawList(luahuddrawlist_intermission);
#endif
if (!splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
@@ -609,6 +601,15 @@ dotimer:
// Make it obvious that scrambling is happening next round.
if (cv_scrambleonchange.value && cv_teamscramble.value && (intertic/TICRATE % 2 == 0))
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, hilicol, M_GetText("Teams will be scrambled next round!"));
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
LUAh_IntermissionHUD(luahuddrawlist_intermission);
}
LUA_HUD_DrawList(luahuddrawlist_intermission);
#endif
}
//
@@ -1230,6 +1231,15 @@ void Y_VoteDrawer(void)
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol,
va("Vote ends in %d", tickdown));
}
#ifdef HAVE_BLUA
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_vote);
LUAh_VoteHUD(luahuddrawlist_vote);
}
LUA_HUD_DrawList(luahuddrawlist_vote);
#endif
}
//
@@ -1559,6 +1569,11 @@ void Y_StartVote(void)
}
voteclient.loaded = true;
#ifdef HAVE_BLUA
LUA_HUD_DestroyDrawList(luahuddrawlist_vote);
luahuddrawlist_vote = LUA_HUD_CreateDrawList();
#endif
}
//
+250 -252
View File
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by Graue.
// Copyright (C) 2006-2023 by Sonic Team Junior.
// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -27,7 +27,6 @@
#include "doomdef.h"
#include "doomstat.h"
#include "r_patch.h"
#include "i_system.h" // I_GetFreeMem
#include "i_video.h" // rendermode
#include "z_zone.h"
@@ -50,11 +49,27 @@ static boolean Z_calloc = false;
//#define ZDEBUG2
#endif
struct memblock_s;
typedef struct
{
struct memblock_s *block; // Describing this memory
UINT32 id; // Should be ZONEID
} ATTRPACK memhdr_t;
// Some code might want aligned memory. Assume it wants memory n bytes
// aligned -- then we allocate n-1 extra bytes and return a pointer to
// the first byte aligned as requested.
// Thus, "real" is the pointer we get from malloc() and will free()
// later, but "hdr" is where the memhdr_t starts.
// For non-aligned allocations they will be the same.
typedef struct memblock_s
{
void *real;
memhdr_t *hdr;
void **user;
INT32 tag; // purgelevel
UINT32 id; // Should be ZONEID
size_t size; // including the header and blocks
size_t realsize; // size of real data only
@@ -65,41 +80,74 @@ typedef struct memblock_s
#endif
struct memblock_s *next, *prev;
} memblock_t;
} ATTRPACK memblock_t;
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t))
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - sizeof(memblock_t))
#ifdef ZDEBUG
#define Ptr2Memblock(s, f) Ptr2Memblock2(s, f, __FILE__, __LINE__)
static memblock_t *Ptr2Memblock2(void *ptr, const char* func, const char *file, INT32 line)
#else
static memblock_t *Ptr2Memblock(void *ptr, const char* func)
#endif
{
memhdr_t *hdr;
memblock_t *block;
if (ptr == NULL)
return NULL;
#ifdef ZDEBUG2
CONS_Printf("%s %s:%d\n", func, file, line);
#endif
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
#ifdef VALGRIND_MAKE_MEM_DEFINED
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
#endif
#ifdef VALGRIND_MEMPOOL_EXISTS
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
{
#ifdef ZDEBUG
I_Error("%s: bad memblock from %s:%d", func, file, line);
#else
I_Error("%s: bad memblock", func);
#endif
}
#endif
if (hdr->id != ZONEID)
{
#ifdef ZDEBUG
I_Error("%s: wrong id from %s:%d", func, file, line);
#else
I_Error("%s: wrong id", func);
#endif
}
block = hdr->block;
#ifdef VALGRIND_MAKE_MEM_NOACCESS
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
#endif
return block;
}
// both the head and tail of the zone memory block list
static memblock_t head;
//
// Function prototypes
//
static void Command_Memfree_f(void);
#ifdef ZDEBUG
static void Command_Memdump_f(void);
#endif
// --------------------------
// Zone memory initialisation
// --------------------------
/** Initialises zone memory.
* Used at game startup.
*
* \sa I_GetFreeMem, Command_Memfree_f, Command_Memdump_f
*/
void Z_Init(void)
{
size_t total, memfree;
UINT32 total, memfree;
memset(&head, 0x00, sizeof(head));
head.next = head.prev = &head;
memfree = I_GetFreeMem(&total)>>20;
CONS_Printf("System memory: %sMB - Free: %sMB\n", sizeu1(total>>20), sizeu2(memfree));
CONS_Printf("System memory: %uMB - Free: %uMB\n", total>>20, memfree);
// Note: This allocates memory. Watch out.
COM_AddCommand("memfree", Command_Memfree_f);
@@ -109,17 +157,6 @@ void Z_Init(void)
#endif
}
// ----------------------
// Zone memory allocation
// ----------------------
/** Frees allocated memory.
*
* \param ptr A pointer to allocated memory,
* assumed to have been allocated with Z_Malloc/Z_Calloc.
* \sa Z_FreeTags
*/
#ifdef ZDEBUG
void Z_Free2(void *ptr, const char *file, INT32 line)
#else
@@ -135,14 +172,10 @@ void Z_Free(void *ptr)
CONS_Debug(DBG_MEMORY, "Z_Free %s:%d\n", file, line);
#endif
block = MEMBLOCK(ptr);
#ifdef PARANOIA
if (block->id != ZONEID)
#ifdef ZDEBUG
I_Error("Z_Free at %s:%d: wrong id", file, line);
block = Ptr2Memblock2(ptr, "Z_Free", file, line);
#else
I_Error("Z_Free: wrong id");
#endif
block = Ptr2Memblock(ptr, "Z_Free");
#endif
#ifdef ZDEBUG
@@ -150,9 +183,11 @@ void Z_Free(void *ptr)
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
#endif
#ifdef HAVE_BLUA
// anything that isn't by lua gets passed to lua just in case.
if (block->tag != PU_LUA)
LUA_InvalidateUserdata(ptr);
#endif
// TODO: if zdebugging, make sure no other block has a user
// that is about to be freed.
@@ -161,27 +196,21 @@ void Z_Free(void *ptr)
if (block->user != NULL)
*block->user = NULL;
#ifdef VALGRIND_DESTROY_MEMPOOL
VALGRIND_DESTROY_MEMPOOL(block);
#endif
// Free the memory and get rid of the block.
free(block->real);
block->prev->next = block->next;
block->next->prev = block->prev;
free(block);
#ifdef VALGRIND_DESTROY_MEMPOOL
VALGRIND_DESTROY_MEMPOOL(block);
#endif
}
/** malloc() that doesn't accept failure.
*
* \param size Amount of memory to be allocated, in bytes.
* \return A pointer to the allocated memory.
*/
// malloc() that doesn't accept failure.
static void *xm(size_t size)
{
const size_t padedsize = size+sizeof (size_t);
void *p;
if (padedsize < size)/* overflow check */
I_Error("You are allocating memory too large!");
p = malloc(padedsize);
void *p = malloc(padedsize);
if (p == NULL)
{
@@ -191,6 +220,10 @@ static void *xm(size_t size)
if (p == NULL)
{
#if defined (_NDS) | defined (_PSP)
// Temporary-ish debugging measure
Command_Memfree_f();
#endif
I_Error("Out of memory allocating %s bytes", sizeu1(size));
}
}
@@ -198,18 +231,10 @@ static void *xm(size_t size)
return p;
}
/** The Z_MallocAlign function.
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
*
* \param size Amount of memory to be allocated, in bytes.
* \param tag Purge tag.
* \param user The address of a pointer to the memory to be allocated.
* When the memory is freed by Z_Free later,
* the pointer at this address will then be automatically set to NULL.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_CallocAlign, Z_ReallocAlign
*/
// Z_Malloc
// You can pass Z_Malloc() a NULL user if the tag is less than
// PU_PURGELEVEL.
#ifdef ZDEBUG
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
const char *file, INT32 line)
@@ -217,67 +242,75 @@ void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
#endif
{
size_t extrabytes = (1<<alignbits) - 1;
size_t padsize = 0;
memblock_t *block;
void *ptr;
(void)(alignbits); // no longer used, so silence warnings.
memhdr_t *hdr;
void *given;
size_t blocksize = extrabytes + sizeof *hdr + size;
#ifdef ZDEBUG2
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
#endif
block = xm(sizeof (memblock_t) + size);
ptr = MEMORY(block);
I_Assert((intptr_t)ptr % sizeof (void *) == 0);
block = xm(sizeof *block);
#ifdef HAVE_VALGRIND
padsize += (1<<sizeof(size_t))*2;
#endif
ptr = xm(blocksize + padsize*2);
// This horrible calculation makes sure that "given" is aligned
// properly.
given = (void *)((size_t)((UINT8 *)ptr + extrabytes + sizeof *hdr + padsize/2)
& ~extrabytes);
// The mem header lives 'sizeof (memhdr_t)' bytes before given.
hdr = (memhdr_t *)((UINT8 *)given - sizeof *hdr);
#ifdef VALGRIND_CREATE_MEMPOOL
VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc);
Z_calloc = false;
#endif
#ifdef VALGRIND_MEMPOOL_ALLOC
VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr);
#endif
block->next = head.next;
block->prev = &head;
head.next = block;
block->next->prev = block;
block->real = ptr;
block->hdr = hdr;
block->tag = tag;
block->user = NULL;
#ifdef ZDEBUG
block->ownerline = line;
block->ownerfile = file;
#endif
block->size = sizeof (memblock_t) + size;
block->size = blocksize;
block->realsize = size;
#ifdef VALGRIND_CREATE_MEMPOOL
VALGRIND_CREATE_MEMPOOL(block, size, Z_calloc);
#endif
hdr->id = ZONEID;
hdr->block = block;
block->id = ZONEID;
#ifdef VALGRIND_MAKE_MEM_NOACCESS
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
#endif
if (user != NULL)
{
block->user = user;
*(void **)user = ptr;
*(void **)user = given;
}
else if (tag >= PU_PURGELEVEL)
I_Error("Z_Malloc: attempted to allocate purgable block "
"(size %s) with no user", sizeu1(size));
return ptr;
return given;
}
/** The Z_CallocAlign function.
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
* Unlike Z_MallocAlign, this also initialises the bytes to zero.
*
* \param size Amount of memory to be allocated, in bytes.
* \param tag Purge tag.
* \param user The address of a pointer to the memory to be allocated.
* When the memory is freed by Z_Free later,
* the pointer at this address will then be automatically set to NULL.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_MallocAlign, Z_ReallocAlign
*/
#ifdef ZDEBUG
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
#else
@@ -294,26 +327,10 @@ void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
#endif
}
/** The Z_ReallocAlign function.
* Reallocates a block of memory with a new size.
*
* \param ptr A pointer to allocated memory,
* assumed to have been allocated with Z_Malloc/Z_Calloc.
* If NULL, this function instead acts as a wrapper for Z_CallocAlign.
* \param size New size of memory block, in bytes.
* If zero, then the memory is freed and NULL is returned.
* \param tag New purge tag.
* \param user The address of a pointer to the memory to be reallocated.
* This can be a different user to the one originally assigned to the memory block.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \return A pointer to the reallocated memory. Can be NULL if memory was freed.
* \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_MallocAlign, Z_CallocAlign
*/
#ifdef ZDEBUG
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
#else
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits)
void *Z_ReallocAlign(void *ptr, size_t size,INT32 tag, void *user, INT32 alignbits)
#endif
{
void *rez;
@@ -339,14 +356,10 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
#endif
}
block = MEMBLOCK(ptr);
#ifdef PARANOIA
if (block->id != ZONEID)
#ifdef ZDEBUG
I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line);
block = Ptr2Memblock2(ptr, "Z_Realloc", file, line);
#else
I_Error("Z_ReallocAlign: wrong id");
#endif
block = Ptr2Memblock(ptr, "Z_Realloc");
#endif
if (block == NULL)
@@ -384,11 +397,6 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
return rez;
}
/** Frees all memory for a given set of tags.
*
* \param lowtag The lowest tag to consider.
* \param hightag The highest tag to consider.
*/
void Z_FreeTags(INT32 lowtag, INT32 hightag)
{
memblock_t *block, *next;
@@ -397,57 +405,28 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
for (block = head.next; block != &head; block = next)
{
next = block->next; // get link before freeing
if (block->tag >= lowtag && block->tag <= hightag)
Z_Free(MEMORY(block));
Z_Free((UINT8 *)block->hdr + sizeof *block->hdr);
}
}
/** Iterates through all memory for a given set of tags.
*
* \param lowtag The lowest tag to consider.
* \param hightag The highest tag to consider.
* \param iterfunc The iterator function.
*/
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
{
memblock_t *block, *next;
//
// Z_CheckMemCleanup
//
// TODO: Currently blocks >= PU_PURGELEVEL are freed every
// CLEANUPCOUNT. It might be better to keep track of
// the total size of all purgable memory and free it when the
// size exceeds some value.
//
// This was in Z_Malloc, but was freeing data at
// unsafe times. Now it is only called when it is safe
// to cleanup memory.
if (!iterfunc)
I_Error("Z_IterateTags: no iterator function was given");
for (block = head.next; block != &head; block = next)
{
next = block->next; // get link before possibly freeing
if (block->tag >= lowtag && block->tag <= hightag)
{
void *mem = MEMORY(block);
boolean free = iterfunc(mem);
if (free)
Z_Free(mem);
}
}
}
// -----------------
// Utility functions
// -----------------
// starting value of nextcleanup
#define CLEANUPCOUNT 2000
// number of function calls left before next cleanup
static INT32 nextcleanup = CLEANUPCOUNT;
/** This was in Z_Malloc, but was freeing data at
* unsafe times. Now it is only called when it is safe
* to cleanup memory.
*
* \todo Currently blocks >= PU_PURGELEVEL are freed every
* CLEANUPCOUNT. It might be better to keep track of
* the total size of all purgable memory and free it when the
* size exceeds some value.
*/
void Z_CheckMemCleanup(void)
{
if (nextcleanup-- == 0)
@@ -466,13 +445,15 @@ void Z_CheckMemCleanup(void)
void Z_CheckHeap(INT32 i)
{
memblock_t *block;
memhdr_t *hdr;
UINT32 blocknumon = 0;
void *given;
for (block = head.next; block != &head; block = block->next)
{
blocknumon++;
given = MEMORY(block);
hdr = block->hdr;
given = (UINT8 *)hdr + sizeof *hdr;
#ifdef ZDEBUG2
CONS_Debug(DBG_MEMORY, "block %u owned by %s:%d\n",
blocknumon, block->ownerfile, block->ownerline);
@@ -488,7 +469,7 @@ void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
);
}
#endif
if (block->user != NULL && *(block->user) != given)
@@ -501,7 +482,7 @@ void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
);
}
if (block->next->prev != block)
{
@@ -513,7 +494,7 @@ void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
);
}
if (block->prev->next != block)
{
@@ -525,9 +506,25 @@ void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
);
}
if (block->id != ZONEID)
#ifdef VALGRIND_MAKE_MEM_DEFINED
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
#endif
if (hdr->block != block)
{
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" doesn't have linkback from allocated memory",
i, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
}
if (hdr->id != ZONEID)
{
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
@@ -537,37 +534,50 @@ void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
);
);
}
#ifdef VALGRIND_MAKE_MEM_NOACCESS
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
#endif
}
}
// ------------------------
// Zone memory modification
// ------------------------
/** Changes a memory block's purge tag.
*
* \param ptr A pointer to allocated memory,
* assumed to have been allocated with Z_Malloc/Z_Calloc.
* \param tag The new tag.
* \sa Z_SetUser
*/
#ifdef PARANOIA
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line)
#else
void Z_ChangeTag(void *ptr, INT32 tag)
void Z_ChangeTag2(void *ptr, INT32 tag)
#endif
{
memblock_t *block;
memhdr_t *hdr;
if (ptr == NULL)
return;
block = MEMBLOCK(ptr);
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
#ifdef VALGRIND_MAKE_MEM_DEFINED
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
#endif
#ifdef VALGRIND_MEMPOOL_EXISTS
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
{
#ifdef PARANOIA
if (block->id != ZONEID) I_Error("Z_ChangeTag at %s:%d: wrong id", file, line);
I_Error("Z_CT at %s:%d: bad memblock", file, line);
#else
I_Error("Z_CT: bad memblock");
#endif
}
#endif
#ifdef PARANOIA
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
#endif
block = hdr->block;
#ifdef VALGRIND_MAKE_MEM_NOACCESS
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
#endif
if (tag >= PU_PURGELEVEL && block->user == NULL)
@@ -577,48 +587,12 @@ void Z_ChangeTag(void *ptr, INT32 tag)
block->tag = tag;
}
/** Changes a memory block's user.
*
* \param ptr A pointer to allocated memory,
* assumed to have been allocated with Z_Malloc/Z_Calloc.
* \param newuser The new user for the memory block.
* \sa Z_ChangeTag
*/
#ifdef PARANOIA
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
#else
void Z_SetUser(void *ptr, void **newuser)
#endif
{
memblock_t *block;
if (ptr == NULL)
return;
block = MEMBLOCK(ptr);
#ifdef PARANOIA
if (block->id != ZONEID) I_Error("Z_SetUser at %s:%d: wrong id", file, line);
#endif
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
I_Error("Internal memory management error: "
"tried to make block purgable but it has no owner");
block->user = (void*)newuser;
*newuser = ptr;
}
// -----------------
// Zone memory usage
// -----------------
/** Calculates memory usage for a given set of tags.
*
* \param lowtag The lowest tag to consider.
* \param hightag The highest tag to consider.
* \return Number of bytes currently allocated in the heap for the
* given tags.
* \sa Z_TagUsage
*/
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
{
@@ -635,54 +609,45 @@ size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
return cnt;
}
// -----------------------
// Miscellaneous functions
// -----------------------
/** The function called by the "memfree" console command.
* Prints the memory being used by each part of the game to the console.
*/
static void Command_Memfree_f(void)
size_t Z_TagUsage(INT32 tagnum)
{
size_t freebytes, totalbytes;
return Z_TagsUsage(tagnum, tagnum);
}
void Command_Memfree_f(void)
{
UINT32 freebytes, totalbytes;
Z_CheckHeap(-1);
CONS_Printf("\x82%s", M_GetText("Memory Info\n"));
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TotalUsage()>>10));
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TagsUsage(0, INT32_MAX)>>10));
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
sizeu1(Z_TagsUsage(PU_PURGELEVEL, INT32_MAX)>>10));
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
{
CONS_Printf(M_GetText("Patch info headers : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
CONS_Printf(M_GetText("Cached textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
CONS_Printf(M_GetText("Texture colormaps : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
CONS_Printf(M_GetText("All GPU textures : %7d KB\n"), HWR_GetTextureUsed()>>10);
CONS_Printf(M_GetText("Patch info headers: %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
CONS_Printf(M_GetText("All GPU textures : %7s KB\n"), sizeu1(HWR_GetTextureUsed()>>10));
}
#endif
CONS_Printf("\x82%s", M_GetText("System Memory Info\n"));
freebytes = I_GetFreeMem(&totalbytes);
CONS_Printf(M_GetText(" Total physical memory: %s KB\n"), sizeu1(totalbytes>>10));
CONS_Printf(M_GetText("Available physical memory: %s KB\n"), sizeu1(freebytes>>10));
CONS_Printf(M_GetText(" Total physical memory: %7u KB\n"), totalbytes>>10);
CONS_Printf(M_GetText("Available physical memory: %7u KB\n"), freebytes>>10);
}
#ifdef ZDEBUG
/** The function called by the "memdump" console command.
* Prints zone memory debugging information (i.e. tag, size, location in code allocated).
* Can be all memory allocated in game, or between a set of tags (if -min/-max args used).
* This command is available only if ZDEBUG is enabled.
*/
static void Command_Memdump_f(void)
{
memblock_t *block;
@@ -704,12 +669,45 @@ static void Command_Memdump_f(void)
}
#endif
/** Creates a copy of a string.
*
* \param s The string to be copied.
* \return A copy of the string, allocated in zone memory.
*/
// Creates a copy of a string.
char *Z_StrDup(const char *s)
{
return strcpy(ZZ_Alloc(strlen(s) + 1), s);
}
#ifdef PARANOIA
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
#else
void Z_SetUser2(void *ptr, void **newuser)
#endif
{
memblock_t *block;
memhdr_t *hdr;
if (ptr == NULL)
return;
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
#ifdef VALGRIND_MAKE_MEM_DEFINED
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
#endif
#ifdef PARANOIA
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
#endif
block = hdr->block;
#ifdef VALGRIND_MAKE_MEM_NOACCESS
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
#endif
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
I_Error("Internal memory management error: "
"tried to make block purgable but it has no owner");
block->user = (void*)newuser;
*newuser = ptr;
}
+64 -88
View File
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2023 by Sonic Team Junior.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -15,7 +15,6 @@
#define __Z_ZONE__
#include <stdio.h>
#include "doomdef.h"
#include "doomtype.h"
#ifdef __GNUC__ // __attribute__ ((X))
@@ -31,120 +30,97 @@
//#define ZDEBUG
//
// Purge tags
//
// Now they are an enum! -- Monster Iestyn 15/02/18
//
enum
{
// Tags < PU_LEVEL are not purged until freed explicitly.
PU_STATIC = 1, // static entire execution time
PU_LUA = 2, // static entire execution time -- used by lua so it doesn't get caught in loops forever
PU_PERFSTATS = 3, // static between changes to ps_samplesize cvar
// ZONE MEMORY
// PU - purge tags.
// Tags < PU_LEVEL are not purged until freed explicitly.
#define PU_STATIC 1 // static entire execution time
#define PU_LUA 2 // static entire execution time -- used by lua so it doesn't get caught in loops forever
#define PU_PERFSTATS 3 // static between changes to ps_samplesize cvar
PU_SOUND = 11, // static while playing
PU_MUSIC = 12, // static while playing
PU_HUDGFX = 13, // static until WAD added
#define PU_SOUND 11 // static while playing
#define PU_MUSIC 12 // static while playing
#define PU_HUDGFX 13 // static until WAD added
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
#define PU_HWRPATCHINFO 21 // Hardware GLPatch_t struct for OpenGL texture cache
#define PU_HWRPATCHCOLMIPMAP 22 // Hardware GLMipmap_t struct colromap variation of patch
PU_HWRCACHE = 48, // static until unlocked
PU_CACHE = 49, // static until unlocked
#define PU_HWRCACHE 48 // static until unlocked
#define PU_CACHE 49 // static until unlocked
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
PU_LEVEL = 50, // static until level exited
PU_LEVSPEC = 51, // a special thinker in a level
PU_HWRPLANE = 52, // if ZPLANALLOC is enabled in hw_bsp.c, this is used to alloc polygons for OpenGL
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
#define PU_LEVEL 50 // static until level exited
#define PU_LEVSPEC 51 // a special thinker in a level
#define PU_HWRPLANE 52
// Tags >= PU_PURGELEVEL are purgable whenever needed
PU_PURGELEVEL = 100, // Note: this is never actually used as a tag
PU_CACHE_UNLOCKED = 101, // Note: unused
PU_HWRCACHE_UNLOCKED = 102, // 'unlocked' PU_HWRCACHE memory:
// 'second-level' cache for graphics
// stored in hardware format and downloaded as needed
PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRMODELTEXTURE memory
};
// Tags >= PU_PURGELEVEL are purgable whenever needed
#define PU_PURGELEVEL 100
#define PU_CACHE_UNLOCKED 101
#define PU_HWRCACHE_UNLOCKED 102 // 'second-level' cache for graphics
// stored in hardware format and downloaded as needed
#define PU_HWRPATCHINFO_UNLOCKED 103
//
// Zone memory initialisation
//
void Z_Init(void);
void Z_FreeTags(INT32 lowtag, INT32 hightag);
void Z_CheckMemCleanup(void);
void Z_CheckHeap(INT32 i);
#ifdef PARANOIA
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
#else
void Z_ChangeTag2(void *ptr, INT32 tag);
#endif
//
// Zone memory allocation
//
// enable ZDEBUG to get the file + line the functions were called from
// for ZZ_Alloc, see doomdef.h
//
#ifdef PARANOIA
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
#else
void Z_SetUser2(void *ptr, void **newuser);
#endif
// Z_Free and alloc with alignment
#ifdef ZDEBUG
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
void Z_Free2(void *ptr, const char *file, INT32 line);
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, 0, __FILE__, __LINE__)
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, 0, __FILE__, __LINE__)
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
#define Z_Realloc(p,s,t,u) Z_Realloc2(p, s, t, u, 0, __FILE__, __LINE__)
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
#else
void Z_Free(void *ptr);
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, 0)
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, 0)
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2) ;
#define Z_Realloc(p, s,t,u) Z_ReallocAlign(p, s, t, u, 0)
#endif
// Alloc with standard alignment
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *))
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *))
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *))
size_t Z_TagUsage(INT32 tagnum);
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
// Free all memory by tag
// these don't give line numbers for ZDEBUG currently though
// (perhaps this should be changed in future?)
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
void Z_FreeTags(INT32 lowtag, INT32 hightag);
char *Z_StrDup(const char *in);
// Iterate memory by tag
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
//
// Utility functions
//
void Z_CheckMemCleanup(void);
void Z_CheckHeap(INT32 i);
//
// Zone memory modification
//
// enable PARANOIA to get the file + line the functions were called from
// This is used to get the local FILE : LINE info from CPP
// prior to really call the function in question.
//
#ifdef PARANOIA
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t, __FILE__, __LINE__)
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
#else
void Z_ChangeTag(void *ptr, INT32 tag);
void Z_SetUser(void *ptr, void **newuser);
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t)
#endif
//
// Zone memory usage
//
// Note: These give the memory used in bytes,
// shift down by 10 to convert to KB
//
#define Z_TagUsage(tagnum) Z_TagsUsage(tagnum, tagnum)
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
#define Z_TotalUsage() Z_TagsUsage(0, INT32_MAX)
#ifdef PARANOIA
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
#else
#define Z_SetUser(p,u) Z_SetUser2(p, u)
#endif
//
// Miscellaneous functions
//
char *Z_StrDup(const char *in);
#define Z_Unlock(p) (void)p // TODO: remove this now that NDS code has been removed
#ifdef _NDS ///TODO: need a lock reference system
#define Z_Unlock(p) Z_ChangeTag(p, PU_CACHE_UNLOCKED)
#else
#define Z_Unlock(p) (void)p
#endif
#endif