Merge pull request #689 from KEKW555/KEKW555-patch-3

This commit is contained in:
Theo 2024-01-21 00:50:07 -08:00 committed by GitHub
commit d8a9e54fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View File

@ -16,6 +16,7 @@ extern void GenericConfused(struct Entity_*);
extern void sub_08001290(struct Entity_*, u32); extern void sub_08001290(struct Entity_*, u32);
extern void GenericKnockback(struct Entity_*); extern void GenericKnockback(struct Entity_*);
extern u32 GetFuserId(struct Entity_*); extern u32 GetFuserId(struct Entity_*);
#define GetFuserIdAndFuserTextId(ent) ((union SplitDWord)(*(MultiReturnTypeSingleEntityArg)(&GetFuserId))(ent))
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity); extern u32 GravityUpdate(struct Entity_* entity, u32 gravity);
enum { enum {

View File

@ -62,4 +62,6 @@ int MultiBoot(struct MultiBootParam* mp);
s32 Div(s32 num, s32 denom); s32 Div(s32 num, s32 denom);
#define DivAndMod(num, denom) ((union SplitDWord)(*(MultiReturnTypeTwoS32Arg)(&Div))(num, denom))
#endif // SYSCALL_H #endif // SYSCALL_H

View File

@ -119,6 +119,17 @@ typedef struct {
s8 y; s8 y;
} PACKED Coords8; } PACKED Coords8;
union SplitDWord {
s64 DWORD;
u64 DWORD_U;
struct {
s32 LO, HI;
} HALF;
struct {
u32 LO, HI;
} HALF_U;
};
union SplitWord { union SplitWord {
s32 WORD; s32 WORD;
u32 WORD_U; u32 WORD_U;
@ -152,4 +163,10 @@ struct Entity_;
#define BIT(bit) (1 << (bit)) #define BIT(bit) (1 << (bit))
#define IS_BIT_SET(value, bit) ((value)&BIT(bit)) #define IS_BIT_SET(value, bit) ((value)&BIT(bit))
/**
* Multi return function data type casts
*/
typedef u64 (*MultiReturnTypeSingleEntityArg)(struct Entity_*);
typedef s64 (*MultiReturnTypeTwoS32Arg)(s32, s32);
#endif // GLOBAL_H #endif // GLOBAL_H