I just realized this function could be a lot simpler, with some reworking it might even be possible to do the offsets from within the drawstring function instead of using another function for that and having to grab the same patch twice in a row.
EDIT: I must've wrote this when I was tired, you cant really combine these two functions into one because of string alignment.
Latapostrophe (19e6daf2) at 13 May 12:06
Merge branch 'srb2p_22-moreskins' into srb2p_22
Latapostrophe (19e6daf2) at 13 May 12:06
Merge branch 'srb2p_22-moreskins' into srb2p_22
... and 16 more commits
Latapostrophe (49f3444d) at 09 May 18:14
replace srb2.png
Latapostrophe (2a4cd6dc) at 09 May 18:14
Latapostrophe (49f3444d) at 09 May 18:12
replace srb2.png
Latapostrophe (2a4cd6dc) at 08 May 19:20
1.3.5 + fix cmakelist
Caught another apparent artifact of when I was trying to fix up my branches locally. That should be all of them at this point.
Huh, how in the world did I not realize I was testing this without the skin and freeslot increases? Besides that, I also knew about the static initialization being broken for a while, I just never got around to fixing it.(EDIT: It seems that on I had the skin and freeslot increases applied locally when I was testing, So in reality I was testing correctly, the only goof was that I was never testing outside of DEBUGMODE=1.)
I've done a number of netgames at this point on this branch, and the performance improvement is vastly noticeable, cases like viewing the stats menu for a given character haven't been entirely eliminated however, so more work is necessary to remove the bottlenecks in those situations. The only problems I had were mostly because I built with DEBUGMODE=1 which enabled some asserts and would spam the console whenever something got 1 billion references to it. I was not able to get the shopbug to occur in any of the netgames, forgoing the cache and the general search MAY indeed have finally put this bug to rest, but to prove that would require more users doing more tests.
Font drawing is easily the most intensive process in the game, and in low computational power situations can impact the performance of the game whenever lots of text is needed to be drawn.
There are two optimizations at play here:
Realizing that font drawing already has its own lump loading procedure, we can abstract further and give font-related items their own fast cache. This allows for the game to access other elements quickly and also means the normal cache is not being constantly pumped and dumped with font graphics.
Realizing that AT MOST, a given font graphic should only require a single operation to nab, we create 5 separate lumpnum_t arrays for the 5 major fonts in the game. The abstracted font loading process then uses these arrays as a fast path to acquiring their lumpnum_t. Knowing the character requested by the game is important, so the currently processed char is passed along through the functions. The function also is capable of generating the cache table at runtime, since it would be impossible to index it beforehand.
This is probably the most insane thing I have ever created, so lots of testing is needed to see if this does indeed beget a performance improvement. I have an i7-7700HQ laptop that is particularly sensitive to intensive processes and a Steam Deck where I can throttle the CPU's power usage as my testing devices. This change will not have any detectable improvements in a stock Vanilla situation. It seems that loading lots of addons(preferably large character packs) exacerbate the performance issues and is where I will be doing a majority of testing. This also may or may not change shop bug behavior.
Loading as many mods as possible to try and even reach 128 loaded skins showed that we were overflowing sfx freeslots twice over. We now set a new arbitrary limit of 9999 sfx freeslots. Since the sfx table now goes over 10,000 entries, S_InitRuntimeSounds has been modified to handle initializing freeslots past id 9999. This should fix oddities like Eggman's jump sound effect being replaced but may introduce horrors.
Latapostrophe (48480a27) at 16 Jan 20:57
Merge branch 'srb2p_22-moreskins-moresounds' into 'srb2p_22-moreskins'
... and 3 more commits
We should be good to go now.
#6 0x000055e1322e0c39 in S_GetSfxLumpNum (sfx=0x55e132609460 <S_sfx+944768>) at s_sound.c:352
Alright obviously the sound effect array size has started to get out of hand, this will require a bit more tweaking or a decrease to the new limit to be manageable. NUMSKINSOUNDS should only be adding ~5610 more entries so something weird is afoot.
Loading as many mods as possible to try and even reach 128 loaded skins showed that we were overflowing sfx freeslots twice over. We now set a new arbitrary limit of 9999 sfx freeslots. Since the sfx table now goes over 10,000 entries, S_InitRuntimeSounds has been modified to handle initializing freeslots past id 9999. This should fix oddities like Eggman's jump sound effect being replaced but may introduce horrors.
A port of KartKrew/Kart-Public!268 & KartKrew/Kart-Public!291 to SRB2P. The Skin limit being increased necessitated the freeslot increase. Going to make sure people know that having sprite animations using 200 states is still not exactly a good idea despite the extra headroom that would come with this MR.
Latapostrophe (25ccea0f) at 15 Jan 20:56
Merge branch 'srb2p_22-next-255-skins' into 'srb2p_22-moreskins'
... and 1 more commit
Latapostrophe (e57d6c94) at 15 Jan 14:40
Merge branch 'srb2p_22-next-string-drawing-space-fastpath' into 'sr...
... and 1684 more commits