TriForceX / JediKnightPlus

Game modification for Jedi Knight II: Jedi Outcast Multiplayer with useful stuff and custom features
https://jkplus.github.io
GNU General Public License v2.0
21 stars 4 forks source link

possibly skipped processing #11

Closed ihsinme closed 3 years ago

ihsinme commented 3 years ago

good day. if the extreme size is 5. why is it not in the switch processing.

you don't think you need to either limit yourself to 4 or add a case block for 5

https://github.com/TriForceX/JediKnightPlus/blob/caa3a5df01b0fb347a9ab2c18ca634972a740174/code/cgame/cg_drawtools.c#L503

TriForceX commented 3 years ago

you cant simply add a case 5: because the if (width > 5) is for values 6, 7, 8, etc... not for 5.

also the switch case is to set the limits of value based on current width. the if (width > 5) is to set the limit for width, same with the if (width < 1) that is on top, both are to set the limits of width before enter the the switch case, then the switch case perform other actions based on width.

ihsinme commented 3 years ago

good day. thanks for the answer. it clarifies the meaning a little. but if if (width < 1) then processing does not go further. but if if (width > 5), then the processing is going on but no restrictions are set on value. it looks strange.

TriForceX commented 3 years ago

the restrictions for value are inside each case in the switch using ternary operators like value = value > x ? x : value

https://github.com/TriForceX/JediKnightPlus/blob/c2071fb62b22e6287ea05734643bc25b2e363199/code/cgame/cg_drawtools.c#L508-L509

ihsinme commented 3 years ago

absolutely right.

but there is no limit for case width >= 5. since there is no such сase.

TriForceX commented 3 years ago

thats because the value just need to be adjusted only if the width is less than 5, so if width is 5 thats enough to show the amount of numbers in value.

for example if the width is 3, and the value is 5230, this contains more than 3 digits, so the switch case proceed to limit the digits only to 3 numbers, replacing it the value with 999 to not overflow the number container on the user interface.

ihsinme commented 3 years ago

thanks for your time.