From 9fa22baae0d44278cd73a54c1c4a11eac9255bff Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 22 Oct 2012 05:02:49 +0200 Subject: fixes to make Newer compile with Clang... kinda --- include/common.h | 12 +++++++----- include/game.h | 4 ++-- kamek_pal.x | 2 +- src/bossCaptainBowser.cpp | 2 +- src/bossFuzzyBear.cpp | 2 +- src/bossThwompaDomp.cpp | 2 +- src/koopatlas/core.h | 3 +++ src/koopatlas/player.h | 2 +- src/levelinfo.h | 2 +- src/magicplatform.cpp | 8 ++++---- src/newer.cpp | 2 +- 11 files changed, 23 insertions(+), 18 deletions(-) diff --git a/include/common.h b/include/common.h index a070a56..5b85824 100644 --- a/include/common.h +++ b/include/common.h @@ -23,6 +23,8 @@ typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned char uchar; +typedef unsigned long size_t; + typedef char* Ptr; // DUMB typedef int BOOL; @@ -52,7 +54,7 @@ extern "C" int strcmp ( const char * str1, const char * str2 ); #include "rvl/mtx.h" -inline void *operator new(unsigned long size, void *ptr) { return ptr; } +inline void *operator new(size_t size, void *ptr) { return ptr; } @@ -78,10 +80,10 @@ struct tree_node { void OSReport(const char *format, ...); int sprintf(char *buffer, const char *format, ...); -int snprintf(char *buffer, int buff_size, const char *format, ...); -char *strcat(const char *destination, const char *source); -void *memset(void *ptr, int value, unsigned int num); -int memcmp(const void *ptr1, const void *ptr2, unsigned int num); +int snprintf(char *buffer, size_t buff_size, const char *format, ...); +char *strcat(char *destination, const char *source); +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); diff --git a/include/game.h b/include/game.h index 63a076c..2e49ac4 100755 --- a/include/game.h +++ b/include/game.h @@ -1521,10 +1521,10 @@ template class dStateWrapper_c : public dStateWrapperBase_c { public: dStateWrapper_c(TOwner *pOwner) : - dStateWrapperBase_c(pOwner) { } + dStateWrapperBase_c(pOwner) { } dStateWrapper_c(TOwner *pOwner, dState_c *pInitState) : - dStateWrapperBase_c(pOwner, pInitState) { } + dStateWrapperBase_c(pOwner, pInitState) { } ~dStateWrapper_c() { } }; diff --git a/kamek_pal.x b/kamek_pal.x index a00b9e9..77303ad 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1170,7 +1170,7 @@ SECTIONS { _Z6memsetPvij = 0x800046B4; sprintf__FPcPCce = 0x802E1ACC; - snprintf__FPciPCce = 0x802E19D8; + snprintf__FPcUlPCce = 0x802E19D8; memcmp__FPCvPCvUi = 0x802DF388; _Z6strcatPKcS0_ = 0x802E1D2C; diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp index 119779f..2c397da 100644 --- a/src/bossCaptainBowser.cpp +++ b/src/bossCaptainBowser.cpp @@ -220,7 +220,7 @@ int daCaptainBowser::onCreate() { // Normal rects are { left, top, right, bottom } // Callbacks are Touching upwards, Touching Downwards, and unknown - ShipPhysics.baseSetup(this, &ShipPhysicsCallback, 0, 0, 1, 0); + ShipPhysics.baseSetup(this, (void*)&ShipPhysicsCallback, 0, 0, 1, 0); ShipPhysics.x = 8.0; ShipPhysics.y = 20.0; diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index b9312a8..1f4fab4 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -328,7 +328,7 @@ void daFuzzyBear_c::endState_Grow() { void daFuzzyBear_c::beginState_Bounce() { - if (this->direction = 0) { this->speed.x = 1.0; } + if (this->direction == 0) { this->speed.x = 1.0; } else { this->speed.x = -1.0; } if (this->storeSpeed != 0) { this->speed.x = this->storeSpeed; } diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp index 4bce47c..860fb90 100644 --- a/src/bossThwompaDomp.cpp +++ b/src/bossThwompaDomp.cpp @@ -317,7 +317,7 @@ int daEnMegaDosun_c::onDelete() { } this->puruMoveCounter--; - if(this->puruMoveCounter & 2 == 0) + if((this->puruMoveCounter & 2) == 0) return; float _array[] = {2.0, 0.0}; diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 88efdba..ee8cf8f 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -41,6 +41,9 @@ void NewerMapDrawFunc(); class daWMPlayer_c; class dWMMap_c; +class dWMHud_c; +class dWMShop_c; +class dWMStarCoin_c; class dWorldCamera_c; class dScKoopatlas_c : public dScene_c { diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h index d553afb..7b60f60 100644 --- a/src/koopatlas/player.h +++ b/src/koopatlas/player.h @@ -3,7 +3,7 @@ #include "koopatlas/core.h" #include "poweruphax.h" -#include +#include class daWMPlayer_c : public dActor_c { diff --git a/src/levelinfo.h b/src/levelinfo.h index 1e9ee6c..d0eee1a 100644 --- a/src/levelinfo.h +++ b/src/levelinfo.h @@ -1,7 +1,7 @@ #ifndef __NEWER_LEVELINFO_H #define __NEWER_LEVELINFO_H -#include +#include class dLevelInfo_c { public: diff --git a/src/magicplatform.cpp b/src/magicplatform.cpp index e4f3dc0..420aefa 100644 --- a/src/magicplatform.cpp +++ b/src/magicplatform.cpp @@ -158,11 +158,11 @@ int daEnMagicPlatform_c::onCreate() { case Solid: physics.setup(this, 0.0f, 0.0f, fWidth, -fHeight, - &PhysCB1, &PhysCB2, &PhysCB3, 1, 0, 0); + (void*)&PhysCB1, (void*)&PhysCB2, (void*)&PhysCB3, 1, 0, 0); - physics.callback1 = &PhysCB4; - physics.callback2 = &PhysCB5; - physics.callback3 = &PhysCB6; + physics.callback1 = (void*)&PhysCB4; + physics.callback2 = (void*)&PhysCB5; + physics.callback3 = (void*)&PhysCB6; physics.addToList(); break; diff --git a/src/newer.cpp b/src/newer.cpp index dd0dc2c..7c4ce11 100644 --- a/src/newer.cpp +++ b/src/newer.cpp @@ -1,5 +1,5 @@ -#include #include +#include void WriteAsciiToTextBox(nw4r::lyt::TextBox *tb, const char *source) { int i = 0; -- cgit v1.2.3