Issue #123 - Removing Macros#369
Conversation
Addeec constexpr to defined constants. FIxed warning C5055 after enum changes.
Fixed wasrning on unintialized variables. Templated clrmem() macro
moved include to top of file.
Removed duplicate enum def.
Changes macros to constexpr/enums in util.h
Fixed / changed unneeded assignment.
Added using statement for vec3_t / Vector equivalence.
…c sdk files. 3 int in progdefs.h and 3 ints in studio.h changed to unsigned int.
|
Agreed re leaving SDK code alone.
The GRAPH_VERSION comment is just from Valve - the .nod files are v16 and
there's no reason to change it. I think they made changes without version
bumps too (maybe Day One has v16 .nod files that don't match the retail
format).
…On Thu, 26 Mar 2026 at 13:10, Saint Wish ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Can you revert the macro changes in the src/public and src/engine files
because we should avoid making macro changes to the engine SDK header files.
We should avoid making changes to the thirdparty/angelscript, since it's
a thirdparty library source we should avoid making changes to it.
—
Reply to this email directly, view it on GitHub
<#369?email_source=notifications&email_token=AA34IYWP5ITQ4HZDLRKSTV34SSNRRA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMBRGEYTKMZRGEY2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#pullrequestreview-4011153111>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA34IYR4YPN5DITKGNE5LET4SSNRRAVCNFSM6AAAAACW4YQD6KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DAMJRGE2TGMJRGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
If the files need to be 1:1 the same I can remove the using vec3_t added and move back to a define in the vector.h header. |
|
Ah yeah vec3_t and Vector is a mess from memory - different on client and
server.
Do what you need to I reckon.
…On Thu, 26 Mar 2026 at 17:13, Rederick5 ***@***.***> wrote:
*Rederick5* left a comment (MSRevive/MasterSwordRebirth#369)
<#369?email_source=notifications&email_token=AA34IYX2HRLEA24XKHL5EL34STKCXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJTGIZDINRXGA3KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4132246706>
If the files need to be 1:1 the same I can remove the using vec3_t added
and move back to a define in the vector.h header.
There's some comparisons between objects in the sdk which flag
signed/unsigned mismatch warning. 6 ints changed in the last commit. if I
know which side of the comparison can safely be casted, I can keep these as
vanilla and just static cast in the comparisons that they are referenced.
It's about 90 some warnings but would prefer not to pragma disable it.
—
Reply to this email directly, view it on GitHub
<#369?email_source=notifications&email_token=AA34IYX2HRLEA24XKHL5EL34STKCXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJTGIZDINRXGA3KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4132246706>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA34IYQQETTO2BHBE2OQ4VT4STKCXAVCNFSM6AAAAACW4YQD6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMZSGI2DMNZQGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Looks like changing 3 of the sdk files to vec3_t will cause some problems with this PR that will take time to resolve. Might just be a few cpp files missing the appropriate includes, but not sure why it would work as a straight specification but fail when using a macro define unless it's just how the linker is processing. I'm pretty green when it comes to working with any linker issues. the using vec3_t = Vector at the top of: eiface.h or leaving the vec3_t as Vector allows for compile. If absolutely needed to leave these as vanilla I'll probably need to wade back into the files and ensure vector is being included appropriately. I know I changed a few of the includes when removing defines caused redefinition problems. |
|
You can just leave the Vector then if it'll compile. |
(should probably be ext_dll.h?)
|
Was able to find the include issue in animation.cpp. the public files should now all be base and the signed/unsigned mismatch warnings resolved. Also reverted changes to the two third party files. |
SaintWish
left a comment
There was a problem hiding this comment.
Can you also revert the macro changes in src/common since those are also engine header files?
Missing M_PI def for a few files. Re-added nanmask int. Added hard define for missing enums, 'unable to open header file' and it's commented out of another common file.
|
That one hurts a bit, quite a few hours worth, but it has been done, with a few quick fixes to fill in missing defines. |
Nope, I think everything else is good. |
|
Since everything looks good and compiles, I'll probably accept it next week sometime. |
|
Sorry for the delay I'll get to looking at this soon, been busy these last few days. |
|
Sorry for the long wait. LGTM, thanks! |
* Removed static keyword * Removed magic numbers in favor of defines for NULL/TRUE/FALSE * Removed massive comment block from 2011. * Removed some comments. Addeec constexpr to defined constants. FIxed warning C5055 after enum changes. * Removed whitespace * Removed multiple enum definitions, MS defines are in cbase.h * Added missing enums in DMG types to to remove multiple declarations. * Changes defines to enums and constexpr where appropriate * Changes macro define to enum * Changed macros to constexpr/enums * Removed commented logic * Fixed warninng on sign mismatch. Fixed wasrning on unintialized variables. Templated clrmem() macro * Fixed pass by reference not in template * changed define to constexpr. moved include to top of file. * Changed enum to reference enum name. * removed unneded define with menu.h include. * Converted macros to wrapper functions. * templated clrmem macro into function. * Reworked IS_NAN function. thanks copilot for type safety. * Added nanmask to reworkedd IS_NAN * Changed defines to enums/constexpr * Fixed missing semi colon. * Fixed missing equals. Removed duplicate enum def. * Changed vector.h class to allow for constexpr initialization. Changes macros to constexpr/enums in util.h * fixed accidental change to var in init. * Reverted init change for member vars * templated fabs and DotProduct functions * Changed macros to templated functions. Fixed / changed unneeded assignment. * templated FDotProduct function * consted var pass in * changes header functions to be specified as inline * removed fabs unneeded redefinition * Moved VecMutiply definition to inline header function. Converted from macro. * changes two defines to constexpr * fixed ifndef syntax * Revferted syntax change * Removed macro * Fixed warning 4018 signed/unsigned mismatches * Fixed var references and set operations * Changed defines to constexpr/enums. Moved/deduplicated multiple defines for some constants. * changed define to constexpr * Changed macros to functions or constexpr where possible * changed some var to constexpr * removed unneeded define. change some defines to constexpr * Changed iscrript RETURN Macros to functions. Fixed missing typedef in vector include for all builds * fixed reference pass in for vector * changes some defines to constexpr where applicable * Fixed some magic number with enums. Changes a few defines to const. * Line end * Rename STATPROP enums to STAT_PROP * changed unsigned int to int with comment saying may return -1. * removed HUDSCRIPT macro in favor of referencing gHUD struct directly * changed defines to enum/constexpr. changes PI Reference. increased PI precision. * reverting commit * Revert "changed unsigned int to int with comment saying may return -1." This reverts commit 9e3d972. * Revert "changed defines to enum/constexpr." This reverts commit d8069fe. * Fixed broken jaw bone, fixed position return not working right. * fixed removal of not operastions * Reapply "changed unsigned int to int with comment saying may return -1." This reverts commit ec7df61. * changes defines to constexpr enums. fixed enum/float equality comparison warnings. * Fixed flot/int equality comparison warning. * Changed RANDOM_LONG to template. Fixed signed/unsigned warnings. * turned random_float macro into template. * changed macros to enums and/or constexpr. functionalize ALLOC_STRING for client def. * removed vec3_t define. Changed references to Vector type. * Removed extra space from replace * changed some defines to constexpr/enum * Removed macro. Changed classes to have buffer/name hard mentioned on class object. * Changed a few NULL to null ptr. changes Screen values * changed READ_BOOL to function * Changed define to constexpr * changed define to constexpr * changed to safe versions of strcpy and strncpy. ensured keyname was 0 terminated. changed NULL to nullptr in a few places. * fixed keyname not being zero terminated * Revert "Changed a few NULL to null ptr." This reverts commit 7111818. * changed GAME_LEAP to function, changed NULL to nullptr changed defines to enum * changed defines to costexpr or enums where applicable * fixed tabbing * changed define to constexpr * Changed ScreenHeight/ScreenWidth defines to functions. * chasnged NULL to nullptr * changed TRUE to true and FALSE to false. Removed redefinition of true keyword. * changed define to constexpr. changes NULL to nullptr * changed defines to constexpr / const where applicable * changed define to constexpr, changed to safe printf * changed defines to constexpr/enum * Changed VEC_TO_ANGLES to function * updated define to constexpr int, change to inline. * inline commit * changed nulls to nullptrs * changed some NULL to nullptr * Changes null to nullptr. changed defines to enums. regroups some enums to door.h header file. Included door.h header into multiplay_gamerules.cpp * commended why this macro is needed * Added other enum entries to main enum. re-added missing button_use_only enum * changed some nulls to nullptr * changed nulls to nullptr * Changed null to nullptr * changes functions to _s variants to fix warning. * changed null to nullptr. changed define to enum * Changed defines to constexpr/enum. Changed null to nullptr * changes defines to enums/constexpr * changed define to constexpr changed null to nullptr * changes NULL to nullptr * changed some null to nullptr * changes define to enum. changes NULL pointers to nullptr * changed NULL to nullptr * changed define to constexpr * Groups defines into an enum in the header file. * changed defines to constexpr/enum * changed definest to enums. moved solitary enum to effects.h added effects.h as include * moved define to transtype enum. moved transtype enum to header file. * changed define to enum * changed define to constexpr * change define to constexpr * changed define to constexpr * Fixed float-enum comparison warning * changed some defines to enums * changed define to enum. group at top of file. * changed define to constexpr * moved SF to effects.h enum * Moves enum in triggers to effects.h added include * moved included and defines to top of file. added include guard. * fixed syntax error * fixed typo in var name. Changed REQPARAMS macro to function. * changed to constexpr * changed defines to constexpr * changed defines to enum. Added include for studio.h removed redefition of studio_looping * removed whitespace * moved define to enum in door.h * changed defines to enums. moved to door.h groups enums into more logical sections. * changed defines to enum,s * changed defines to enum * moved consts to header. * changed costexpr to enum * changed define to constexpr * changed define to const/enum * changes defines to functions/enums/constexpr most consts to header. * changed defs to enum * changed plat to enum * named some enums * changed defs to enum. moved enum to header * changed defines to enum * changed define to enum * changed some defines to constexpr * fixed unitialized memory warning * templated SWAP macro. Changed some defines to constexpr/enum * fix redef of param in templated swap. * removed unneded empty CONSTANT define * changed gib to to enum grouping * Removed macros * named enums * commented unused macros. Added extern to UTIL commented out unneeded include. * changed define to function. named some enums * commented out unused macros. changed MAX_ var names to fit more standard naming convention * changed macrodefine to constexpr * changed defines to enums * ensured RANDOM LONG/FLOAT templated functions were static casted to expected type. * changed define to enum. moved consts to header * removed header include * changed define to enum, moved to trains header changeg defines to const, moved to player header. added if guard to bodyparts_human_h * changed define to constexpr, moved to header * moved class defs to header. added include guard for global.h * changed variable name to follow MAX_ prefixing. Moved class/structs to header * moved comment back to class reference * made const prefixing more consistent. groups consts in header * changes from previod commit message * groups const at top of header file. * commented out unused macros * changed defines enums moved some enums to header files. grouped constexp * removed unneeded comma * removed if guard * changed define to constexpr. moved to header. * changed define to constexpr. moved to header. * removed whitespace * changed define to constexpr. moved to header. commented out pragma disable. * named enum moved include to of file. moved unneeded nested ifdef. * renamed constexpr to MAX_ prefixing. moved CHAR_TEXT snow constexpr to enum * renamed const to MAX_ prefixing. Moved to header * reverted last commit * remove doubled value * changed pitch yaw roll to enum * removed unneeded defines * Removed duplicate stuct defs. Added com_model.h include. * changed define to enum, moved to header * moved max clib speed to player.h. removed duplicate referenced, name to default CLIMB_ value * fixed typing. moved enum to headr * added breaks for variable groupings. * removed defined. changed referenze to constexpr Vector * changed define to constexpr moved to header * changed define to constexpr. removed unneeded define. * Removed redefinition of constexpr. * combined split enum using same flagset to same enum. renamed to follow other enums conventions. * Removed unneeded defines. Mvoed enum to player.h * changed define to constexpr * changed literal define to constexpr * added comment for keeping one as define * changed macro to function * changed function to static * moved constexpr to top of file * named enums * changed BACKUP_NAME macro to function. * named enum * changed defines to constexpr * changed defines to constexpr * removed unneeded macro. changed macros to class member functions. * Removed macro deifne and replaced with function call. * moved defines to header. changed defines to enum/constexpr. * named enum * changed macro to function. moved function to global.h header. * changed defines to constexpr * renamed consts for MAX_ prefixing * unrolled and removed SPEECH_ macros. changed final references of STAT_PROP to MAX_ prefix * changed define to reference pointer to array location. odd location in if else required multiple initializations. * removed TypeCheck Macros * removbed macro and changed to class memberfunction * unrolled and removed macro * moved defines as const char * as class member variables * removed / unrolled macro * changed int to unsigned int * Removed unused macros named some enums * named some enums changed define to constexpr * removed reference to _s functions preventing linux compile * removed reference to _s function preventing linux compile * removed reference to _s functions preventing linux compile. * removed _s from function preventing linux compile. * changed includes to match other include formats for vector.h in two files. * Added include to vector.h for cmath * changes TRUE to true for BOOL implicit conversion * removed _s compile preventing linux compilation * changed FALSE to false * added parenthesis around cast statement preventing linux compile * Reverted changes to all files in the src/[public folder. re-added typedef for vec3_t into vector.h * Revert "Reverted changes to all files in the src/[public folder." This reverts commit b792854. * Reverted changeds to cdll_int.h * Reverting changes to shake.h * reverting changes to two files. * Reverted macro #define changes. Added using statement for vec3_t / Vector equivalence. * unsigned/signed mismatch error present in base types within src/public sdk files. 3 int in progdefs.h and 3 ints in studio.h changed to unsigned int. * changed files back to vanilla * fixed header include order causing issues with file. (should probably be ext_dll.h?) * changed define of vec3_t to c++ standard of using statement within Vector header. * Fixed error 4018 after changing SDK files back to base version * over wrote files with unchanged versions from repo. * Reverted changes to thirdparty files * Removed all changes from src/common files. Missing M_PI def for a few files. Re-added nanmask int. Added hard define for missing enums, 'unable to open header file' and it's commented out of another common file. * undid commend hash removal. * fixed unneeded case change on RETURN_TRUE and RETURN_FALSE functions. Co-authored-by: Rederick5 <73010056+Rederick5@users.noreply.github.com>
This is partial completion. Changed a bit more than I probably should have, but standards indicate that changing to typesafe non-macros should be a good end goal, should it be able to be done safely.
For now, left a lot of the more complex macros, such as the loggers/message and engine callbacks alone.
Changed as many macro functions to class member/file functions / unrolled macros where possible.
Left thirdparty/public/engine files alone for the most part.
Changed all the vec3_t to Vector class, removed all #define constants I could with constexpr/enum where possible.
Resolved a few header inclusion issues / duplicated defines.
changed vector class to be able to be initialized as constexpr class objects.
I can compile without issue and some light testing indicates general stability, but comprehensive testing needs to be completed.
Script events in edana have tested successfully, etc.
FALSE is still cast as int
TRUE is still defined as int
NULL is still defines as int
future issue recommended to change these to true/false/nullptr/0 where applicable