From 06828e3a02a0ca2eaf56d804bb6845659cfa59e7 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 3 Feb 2013 00:31:46 +0100 Subject: fix a bug in the collision headers, and assorted collision bugs --- include/commonX.h | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/daEnDosun_c.h | 2 +- include/game.h | 30 ++++++------- 3 files changed, 134 insertions(+), 16 deletions(-) create mode 100644 include/commonX.h (limited to 'include') diff --git a/include/commonX.h b/include/commonX.h new file mode 100644 index 0000000..ba5a644 --- /dev/null +++ b/include/commonX.h @@ -0,0 +1,118 @@ +#ifndef __KAMEK_COMMON_H +#define __KAMEK_COMMON_H + + +#define GEKKO + +/* Common Number Types */ +typedef signed long long s64; +typedef signed int s32; +typedef signed short s16; +typedef signed char s8; + +typedef unsigned long long u64; +typedef unsigned int u32; +typedef unsigned short u16; +typedef unsigned char u8; + +typedef float f32; +typedef double f64; + +typedef unsigned long ulong; +typedef unsigned int uint; +typedef unsigned short ushort; +typedef unsigned char uchar; + +typedef unsigned long size_t; + +typedef char* Ptr; // DUMB + +typedef int BOOL; +#define TRUE 1 +#define FALSE 0 + +#define NULL 0 + +/* Structures */ +typedef f32 Mtx[3][4]; +typedef f32 (*MtxPtr)[4]; +typedef f32 Mtx44[4][4]; +typedef f32 (*Mtx44Ptr)[4]; +typedef f32 ROMtx[4][3]; +typedef f32 (*ROMtxPtr)[3]; + +typedef struct { f32 x, y; } Vec2, *Vec2Ptr, Point2d, *Point2dPtr; +typedef struct { f32 x, y, z; } Vec, Vec3, *VecPtr, Point3d, *Point3dPtr; +typedef struct { s16 x; s16 y; s16 z; }S16Vec, *S16VecPtr; +typedef struct { f32 x, y, z, w; } Quaternion, *QuaternionPtr, Qtrn, *QtrnPtr; + +typedef struct { f32 frame, value, slope; } HermiteKey; + +extern "C" const char * strrchr ( const char * str, int character ); +extern "C" int strcmp ( const char * str1, const char * str2 ); + +#include "rvl/mtx.h" + + +inline void *operator new(size_t size, void *ptr) { return ptr; } + + + +struct tree_node { + tree_node *parent, *child, *prev_sibling, *next_sibling; + void *obj; +}; + +/* Virtual Function Helpers */ +//#define VF_BEGIN(type, obj, id, vtable_offset) \ +// { type __VFUNC = (((u32)(obj))+(vtable_offset)); +#define VF_BEGIN(type, obj, id, vtable_offset) \ + { type __VFUNC = ((type*)(*((void**)(((u32)(obj))+(vtable_offset)))))[(id)]; + +#define VF_CALL __VFUNC + +#define VF_END } + + + + +/* Common Functions */ + +void OSReport(const char *format, ...); +int sprintf(char *buffer, const char *format, ...); +int snprintf(char *buffer, size_t buff_size, const char *format, ...); +char *strcat(char *destination, const char *source); +extern "C" void *memcpy(void *dest, const void *src, size_t count); +void *memset(void *ptr, int value, size_t num); +int memcmp(const void *ptr1, const void *ptr2, size_t num); + +void *AllocFromGameHeap1(u32 size); +void FreeFromGameHeap1(void *block); + +float GetHermiteCurveValue(float current_frame, HermiteKey* keys, unsigned int key_count); + +/* Archive */ +/*#ifdef REGION_PAL + #define ARC_TABLE ((*((void**)0x8042A318))+4) + #define RAW_ARC_TABLE (*((void**)0x8042A318)) +#endif + +#ifdef REGION_NTSC + #define ARC_TABLE ((*((void**)0x8042A038))+4) + #define RAW_ARC_TABLE (*((void**)0x8042A038)) +#endif + +char *RetrieveFileFromArc(void *table, char *name, char *path); +char *RetrieveFileFromArcAlt(void *table, char *name, char *path);*/ + +extern void *ArchiveHeap; // PAL 0x8042A72C, NTSC 0x8042A44C + + +#ifdef __MWERKS__ + #define InfiniteLoop for (;;) { asm { nop } } +#else + #define InfiniteLoop for (;;) { asm("nop"); } +#endif + + +#endif diff --git a/include/daEnDosun_c.h b/include/daEnDosun_c.h index 34e770a..bba506d 100644 --- a/include/daEnDosun_c.h +++ b/include/daEnDosun_c.h @@ -19,7 +19,7 @@ public: void killedByLevelClear(); // 809f6810 void collisionCat3_StarPower(ActivePhysics* apThis, ActivePhysics *apOther); // 809f6050 void _vf108(ActivePhysics* apThis, ActivePhysics* apOther); // 809f5fe0 - void collisionCatD_GroundPound(ActivePhysics* apThis, ActivePhysics* apOther); // 809f7130 + void collisionCatD_Drill(ActivePhysics* apThis, ActivePhysics* apOther); // 809f7130 void _vf110(ActivePhysics* apThis, ActivePhysics* apOther); // 809f6090 void collisionCat7_GroundPound(ActivePhysics* apThis, ActivePhysics* apOther); // 809f7120 void collisionCat9_RollingObject(ActivePhysics* apThis, ActivePhysics* apOther); // 809f70a0 diff --git a/include/game.h b/include/game.h index 5c7ac05..300efec 100755 --- a/include/game.h +++ b/include/game.h @@ -2354,22 +2354,22 @@ public: virtual void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); // WHAT A MESS - virtual void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void _vf108(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void _vf110(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat8_FencePunch(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat7_GroundPoundYoshi(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void _vf120(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat11_PipeCannon(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool _vf108(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCatD_Drill(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool _vf110(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat8_FencePunch(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat7_GroundPoundYoshi(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool _vf120(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat11_PipeCannon(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); virtual bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); - virtual void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); virtual void _vf140(dStageActor_c *actor); virtual void _vf144(int something); -- cgit v1.2.3