diff --git a/.vscode/settings.json b/.vscode/settings.json index 82b6d2fe..5aa93a55 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -140,6 +140,12 @@ "svd": "cpp", "print": "cpp", "strstream": "cpp", - "regex": "cpp" + "regex": "cpp", + "cassert": "cpp", + "barrier": "cpp", + "coroutine": "cpp", + "future": "cpp", + "latch": "cpp", + "syncstream": "cpp" } } diff --git a/dreamcast/Makefile b/dreamcast/Makefile index 978cce1f..2c644b62 100644 --- a/dreamcast/Makefile +++ b/dreamcast/Makefile @@ -44,8 +44,9 @@ all: $(TARGET) include common.mk +# ../src/Audio/sampman_dc.o OBJS = $(RE3_OBJS) $(RW_OBJS) \ - ../src/Audio/sampman_dc.o \ + ../miami/audio/sampman_null.o \ ../src/prof/profiler.o OBJS_TEXCONV = $(RW_OBJS:.o=.texconv.o) @@ -123,7 +124,7 @@ CXXFLAGS += $(if $(WITH_32MB),-O3,-Os) \ $(if $(WITH_PROF),-DWITH_PROF=\"$(WITH_PROF)\") \ -MMD -MP -ffunction-sections -fdata-sections -ffast-math \ -fmerge-all-constants -fomit-frame-pointer -ml -std=gnu++20 \ - -fno-exceptions -fno-rtti -flto=auto -fipa-pta -Wno-write-strings \ + -fno-exceptions -fno-rtti -fipa-pta -Wno-write-strings \ -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion \ -Wno-multichar -Wno-unused-value -Wno-char-subscripts -Wno-reorder \ -Wno-unused-function -Wno-class-memaccess -fno-permissive \ @@ -163,7 +164,7 @@ $(OBJS_NO_FAST_MATH): %.o: %.cpp $(TARGET): $(OBJS) kos-c++ -o $(TARGET) $(OBJS) -Wl,--gc-sections -Wl,--as-needed -Wl,-Map,output.map \ - -flto=auto $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1 + $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1 @echo && echo && echo "*** Build Completed Successfully ***" && echo && echo run: $(TARGET) diff --git a/dreamcast/common.mk b/dreamcast/common.mk index 05b3258b..e0eef126 100644 --- a/dreamcast/common.mk +++ b/dreamcast/common.mk @@ -24,6 +24,10 @@ git-version.h: git-version.tmp ../miami/skel/dc/dc.cpp: git-version.h +# ../miami/core/CdStreamDC.o \ +# ../miami/skel/dc/dc.o \ +../miami/vmu/vmu.o \ + # List all of your C files here, but change the extension to ".o" # Include "romdisk.o" if you want a rom disk. RE3_OBJS = \ @@ -84,7 +88,6 @@ RE3_OBJS = \ ../miami/core/Accident.o \ ../miami/core/Cam.o \ ../miami/core/Camera.o \ - ../miami/core/CdStreamDC.o \ ../miami/core/Clock.o \ ../miami/core/ControllerConfig.o \ ../miami/core/Debug.o \ @@ -147,7 +150,6 @@ RE3_OBJS = \ ../miami/modelinfo/TimeModelInfo.o \ ../miami/modelinfo/VehicleModelInfo.o \ \ - ../miami/objects/CutsceneHead.o \ ../miami/objects/CutsceneObject.o \ ../miami/objects/DummyObject.o \ ../miami/objects/Object.o \ @@ -218,7 +220,6 @@ RE3_OBJS = \ ../miami/skel/crossplatform.o \ ../miami/skel/events.o \ ../miami/skel/skeleton.o \ - ../miami/skel/dc/dc.o \ \ ../miami/text/Messages.o \ ../miami/text/Pager.o \ @@ -266,7 +267,6 @@ RE3_OBJS = \ ../miami/extras/postfx.o \ ../miami/extras/screendroplets.o \ \ - ../miami/vmu/vmu.o \ ../vendor/miniLZO/minilzo.o \ \ diff --git a/miami/control/CarCtrl.cpp b/miami/control/CarCtrl.cpp index 6742ccfe..5aaf4d23 100644 --- a/miami/control/CarCtrl.cpp +++ b/miami/control/CarCtrl.cpp @@ -84,9 +84,9 @@ #define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f) bool CCarCtrl::bMadDriversCheat; -int CCarCtrl::NumLawEnforcerCars; -int CCarCtrl::NumAmbulancesOnDuty; -int CCarCtrl::NumFiretrucksOnDuty; +int32 CCarCtrl::NumLawEnforcerCars; +int32 CCarCtrl::NumAmbulancesOnDuty; +int32 CCarCtrl::NumFiretrucksOnDuty; bool CCarCtrl::bCarsGeneratedAroundCamera; float CCarCtrl::CarDensityMultiplier = 1.0f; int32 CCarCtrl::NumMissionCars; @@ -811,7 +811,7 @@ CCarCtrl::AddToLoadedVehicleArray(int32 mi, int32 rating, int32 freq) } void -CCarCtrl::RemoveFromLoadedVehicleArray(int mi, int32 rating) +CCarCtrl::RemoveFromLoadedVehicleArray(int32 mi, int32 rating) { int index = 0; while (LoadedCarsArray[rating][index] != -1) { @@ -832,7 +832,7 @@ CCarCtrl::RemoveFromLoadedVehicleArray(int mi, int32 rating) } int32 -CCarCtrl::ChooseCarModelToLoad(int rating) +CCarCtrl::ChooseCarModelToLoad(int32 rating) { return CarArrays[rating][CGeneral::GetRandomNumberInRange(0, TotalNumOfCarsOfRating[rating])]; } @@ -3229,7 +3229,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos) bool created = false; int attempts = 0; CVector spawnPos; - int curNode, nextNode; + int32 curNode, nextNode; float posBetweenNodes; while (!created && attempts < 5){ if (ThePaths.GenerateCarCreationCoors(pPlayerPos.x, pPlayerPos.y, 0.707f, 0.707f, diff --git a/miami/control/PathFind.cpp b/miami/control/PathFind.cpp index 80d40b45..03ff61b6 100644 --- a/miami/control/PathFind.cpp +++ b/miami/control/PathFind.cpp @@ -421,7 +421,7 @@ CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, } void -CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out) +CPathFind::CalcNodeCoors(float x, float y, float z, int32 id, CVector *out) { CVector pos; pos.x = x; @@ -600,7 +600,7 @@ int32 TempListLength; void CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo, - float maxdist, CPathInfoForObject *detachednodes, int numDetached) + float maxdist, CPathInfoForObject *detachednodes, int32 numDetached) { static CVector CoorsXFormed; int i, j, k; diff --git a/miami/control/Pickups.cpp b/miami/control/Pickups.cpp index f6b1a9b9..86627713 100644 --- a/miami/control/Pickups.cpp +++ b/miami/control/Pickups.cpp @@ -1555,7 +1555,7 @@ int16 ThingsToCollect; CPacManPickup CPacManPickups::aPMPickUps[NUMPACMANPICKUPS]; CVector CPacManPickups::LastPickUpCoors; -int32 CPacManPickups::PillsEatenInRace; +int CPacManPickups::PillsEatenInRace; bool CPacManPickups::bPMActive; void diff --git a/miami/control/Script.cpp b/miami/control/Script.cpp index a2dd8512..a9edbf30 100644 --- a/miami/control/Script.cpp +++ b/miami/control/Script.cpp @@ -1062,7 +1062,7 @@ int8 CRunningScript::ProcessOneCommand() int8 CRunningScript::ProcessCommands0To99(int32 command) { float *fScriptVar1; - int *nScriptVar1; + int32 *nScriptVar1; switch (command) { case COMMAND_NOP: return 0; @@ -1795,7 +1795,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) int8 CRunningScript::ProcessCommands100To199(int32 command) { float *fScriptVar1; - int *nScriptVar1; + int32 *nScriptVar1; switch (command) { case COMMAND_SUB_INT_LVAR_FROM_INT_VAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); diff --git a/miami/core/Camera.cpp b/miami/core/Camera.cpp index e7cd65a0..5ce205fe 100644 --- a/miami/core/Camera.cpp +++ b/miami/core/Camera.cpp @@ -2819,7 +2819,7 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time) } bool -CCamera::TryToStartNewCamMode(int obbeMode) +CCamera::TryToStartNewCamMode(int32 obbeMode) { CVehicle *veh; CVector target, camPos, playerSpeed, fwd, fwd2; diff --git a/miami/core/ControllerConfig.h b/miami/core/ControllerConfig.h index d61e23e6..e150c1bd 100644 --- a/miami/core/ControllerConfig.h +++ b/miami/core/ControllerConfig.h @@ -136,8 +136,8 @@ public: GlfwJoyState m_OldState; GlfwJoyState m_NewState; #else - DIJOYSTATE2 m_OldState; - DIJOYSTATE2 m_NewState; + // DIJOYSTATE2 m_OldState; + // DIJOYSTATE2 m_NewState; #endif wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH]; bool m_aButtonStates[MAX_BUTTONS]; diff --git a/miami/core/FileLoader.cpp b/miami/core/FileLoader.cpp index dbf2cad9..b215673a 100644 --- a/miami/core/FileLoader.cpp +++ b/miami/core/FileLoader.cpp @@ -221,7 +221,7 @@ CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlo char modelname[24]; CBaseModelInfo *mi; ColHeader *header; - int modelIndex; + int32 modelIndex; while(size > 8){ header = (ColHeader*)buffer; diff --git a/miami/core/Frontend.cpp b/miami/core/Frontend.cpp index 875bb76b..5a523ff2 100644 --- a/miami/core/Frontend.cpp +++ b/miami/core/Frontend.cpp @@ -4939,7 +4939,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u ControlsManager.MakeControllerActionsBlank(); ControlsManager.InitDefaultControlConfiguration(); ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp()); -#if !defined RW_GL3 +#if defined(RW_DC) + printf("TODO: implement this"); +#elif !defined RW_GL3 if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) { DIDEVCAPS devCaps; devCaps.dwSize = sizeof(DIDEVCAPS); diff --git a/miami/core/General.h b/miami/core/General.h index c17d916d..1da18cfd 100644 --- a/miami/core/General.h +++ b/miami/core/General.h @@ -164,8 +164,17 @@ public: static float GetRandomNumberInRange(float low, float high) { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } + static int GetRandomNumberInRange(int low, int high) + { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } + +#if !defined(INT32_IS_INT) static int32 GetRandomNumberInRange(int32 low, int32 high) { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } + + static int32 GetRandomNumberInRange(int low, const int32& high) + { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } +#endif + static void SetRandomSeed(int32 seed) { mysrand(seed); } }; diff --git a/miami/core/Pad.cpp b/miami/core/Pad.cpp index e75510e5..4e015755 100644 --- a/miami/core/Pad.cpp +++ b/miami/core/Pad.cpp @@ -862,6 +862,8 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp() state.WHEELUP = true; } } +#elif defined(RW_DC) + printf("TODO this %s\n", __func__); #else // It seems there is no way to get number of buttons on mouse, so assign all buttons if we have mouse. double xpos = 1.0f, ypos; @@ -921,6 +923,8 @@ void CPad::UpdateMouse() NewMouseControllerState = PCTempMouseControllerState; } } +#elif defined(RW_DC) + printf("TODO this %s\n", __func__); #else if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) ) { diff --git a/miami/core/Radar.cpp b/miami/core/Radar.cpp index 4e15559d..04b46a4e 100644 --- a/miami/core/Radar.cpp +++ b/miami/core/Radar.cpp @@ -1151,7 +1151,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon) } } -int CRadar::SetCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display) +int32 CRadar::SetCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display) { int nextBlip; for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) { @@ -1177,7 +1177,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay return CRadar::GetNewUniqueBlipIndex(nextBlip); } -int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display) +int32 CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32 color, eBlipDisplay display) { int index = SetCoordBlip(type, pos, color, display); if (index == -1) @@ -1186,7 +1186,7 @@ int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32 color, eB return index; } -int CRadar::SetEntityBlip(eBlipType type, int32 handle, uint32 color, eBlipDisplay display) +int32 CRadar::SetEntityBlip(eBlipType type, int32 handle, uint32 color, eBlipDisplay display) { int nextBlip; for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) { diff --git a/miami/core/Streaming.cpp b/miami/core/Streaming.cpp index 6d980e18..044f7b66 100644 --- a/miami/core/Streaming.cpp +++ b/miami/core/Streaming.cpp @@ -401,10 +401,10 @@ CStreaming::LoadCdDirectory(void) } void -CStreaming::LoadCdDirectory(const char *dirname, int n) +CStreaming::LoadCdDirectory(const char *dirname, int32 n) { int fd, lastID, imgSelector; - int modelId; + int32 modelId; CDirectory::DirectoryInfo direntry; char *dot; diff --git a/miami/core/common.h b/miami/core/common.h index a4c790a7..70380727 100644 --- a/miami/core/common.h +++ b/miami/core/common.h @@ -396,6 +396,9 @@ template struct check_size { #define PERCENT(x, p) ((float(x) * (float(p) / 100.0f))) #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) +#ifdef BIT +#undef BIT +#endif #define BIT(num) (1<<(num)) #define ABS(a) (((a) < 0) ? (-(a)) : (a)) diff --git a/miami/core/re3.cpp b/miami/core/re3.cpp index b9cfc34d..4186981e 100644 --- a/miami/core/re3.cpp +++ b/miami/core/re3.cpp @@ -301,6 +301,12 @@ void StoreIni(const char *cat, const char *key, int8 val) sprintf(temp, "%d", val); cfg[cat][key] = temp; } +void StoreIni(const char *cat, const char *key, bool val) +{ + char temp[11]; + sprintf(temp, "%d", val); + cfg[cat][key] = temp; +} void StoreIni(const char *cat, const char *key, float val) { @@ -973,7 +979,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Special car", SpecialCarCheats); DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat); - static int spawnCarId = MI_LANDSTAL; + static int32 spawnCarId = MI_LANDSTAL; e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_VICECHEE, carnames); DebugMenuEntrySetWrap(e, true); DebugMenuAddCmd("Spawn", "Spawn Car", [](){ @@ -1027,8 +1033,8 @@ DebugMenuPopulate(void) #endif DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil); DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil); - DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil); - DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil); + DebugMenuAddVarBool8("Render", "Frame limiter", (int8_t*)&FrontEndMenuManager.m_PrefsFrameLimiter, nil); + DebugMenuAddVarBool8("Render", "VSynch", (int8_t*)&FrontEndMenuManager.m_PrefsVsync, nil); DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil); #ifdef NEW_RENDERER DebugMenuAddVarBool8("Render", "New Renderer", &gbNewRenderer, nil); @@ -1157,7 +1163,7 @@ extern bool gbRenderWorld2; "PIZZA BOY", "RC Raider Pickup", "RC Bandit Race", "RC Baron Race", "Checkpoint Charlie" }; - missionEntry = DebugMenuAddVar("Game", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions); + missionEntry = DebugMenuAddVar("Game", "Select mission", (uint32_t*)&nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions); DebugMenuEntrySetWrap(missionEntry, true); DebugMenuAddCmd("Game", "Start selected mission ", SwitchToMission); #endif diff --git a/miami/extras/debugmenu.h b/miami/extras/debugmenu.h index f1357c0a..8aa15512 100644 --- a/miami/extras/debugmenu.h +++ b/miami/extras/debugmenu.h @@ -156,21 +156,21 @@ void DebugMenuRender(void); // Some overloads for simplicity inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int8_t *ptr, TriggerFunc triggerFunc, int8_t step, int8_t lowerBound, int8_t upperBound, const char **strings) -{ return DebugMenuAddInt8(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddInt8(path, name, (int8*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int16_t *ptr, TriggerFunc triggerFunc, int16_t step, int16_t lowerBound, int16_t upperBound, const char **strings) -{ return DebugMenuAddInt16(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddInt16(path, name, (int16*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int32_t *ptr, TriggerFunc triggerFunc, int32_t step, int32_t lowerBound, int32_t upperBound, const char **strings) -{ return DebugMenuAddInt32(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddInt32(path, name, (int32*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int64_t *ptr, TriggerFunc triggerFunc, int64_t step, int64_t lowerBound, int64_t upperBound, const char **strings) -{ return DebugMenuAddInt64(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddInt64(path, name, (int64*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint8_t *ptr, TriggerFunc triggerFunc, uint8_t step, uint8_t lowerBound, uint8_t upperBound, const char **strings) -{ return DebugMenuAddUInt8(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddUInt8(path, name, (uint8*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint16_t *ptr, TriggerFunc triggerFunc, uint16_t step, uint16_t lowerBound, uint16_t upperBound, const char **strings) -{ return DebugMenuAddUInt16(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddUInt16(path, name, (uint16*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint32_t *ptr, TriggerFunc triggerFunc, uint32_t step, uint32_t lowerBound, uint32_t upperBound, const char **strings) -{ return DebugMenuAddUInt32(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddUInt32(path, name, (uint32*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint64_t *ptr, TriggerFunc triggerFunc, uint64_t step, uint64_t lowerBound, uint64_t upperBound, const char **strings) -{ return DebugMenuAddUInt64(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } +{ return DebugMenuAddUInt64(path, name, (uint64*)ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, float *ptr, TriggerFunc triggerFunc, float step, float lowerBound, float upperBound) { return DebugMenuAddFloat32(path, name, ptr, triggerFunc, step, lowerBound, upperBound); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, double *ptr, TriggerFunc triggerFunc, double step, double lowerBound, double upperBound) diff --git a/miami/modelinfo/ModelInfo.cpp b/miami/modelinfo/ModelInfo.cpp index 41515e20..14976cdb 100644 --- a/miami/modelinfo/ModelInfo.cpp +++ b/miami/modelinfo/ModelInfo.cpp @@ -182,7 +182,7 @@ CModelInfo::AddVehicleModel(int id) } CBaseModelInfo* -CModelInfo::GetModelInfo(const char *name, int *id) +CModelInfo::GetModelInfo(const char *name, int32 *id) { CBaseModelInfo *modelinfo; for(int i = 0; i < MODELINFOSIZE; i++){ diff --git a/miami/modelinfo/ModelInfo.h b/miami/modelinfo/ModelInfo.h index a0ee0015..6a6cd7ab 100644 --- a/miami/modelinfo/ModelInfo.h +++ b/miami/modelinfo/ModelInfo.h @@ -34,8 +34,8 @@ public: static CStore &Get2dEffectStore(void) { return ms_2dEffectStore; } - static CBaseModelInfo *GetModelInfo(const char *name, int *id); - static CBaseModelInfo *GetModelInfo(int id){ + static CBaseModelInfo *GetModelInfo(const char *name, int32 *id); + static CBaseModelInfo *GetModelInfo(int32 id){ return ms_modelInfoPtrs[id]; } static CBaseModelInfo *GetModelInfo(const char *name, int minIndex, int maxIndex); diff --git a/miami/peds/Ped.cpp b/miami/peds/Ped.cpp index 6cbe7484..aace82e8 100644 --- a/miami/peds/Ped.cpp +++ b/miami/peds/Ped.cpp @@ -7596,7 +7596,7 @@ CPed::SeekCar(void) bool CPed::CheckForExplosions(CVector2D &area) { - int event = 0; + int32 event = 0; if (CEventList::FindClosestEvent(EVENT_EXPLOSION, GetPosition(), &event)) { area.x = gaEvent[event].posn.x; area.y = gaEvent[event].posn.y; @@ -7640,7 +7640,7 @@ CPed::CheckForExplosions(CVector2D &area) CPed * CPed::CheckForGunShots(void) { - int event; + int32 event; if (CEventList::FindClosestEvent(EVENT_GUNSHOT, GetPosition(), &event)) { if (gaEvent[event].entityType == EVENT_ENTITY_PED) { // Probably due to we don't want peds to go gunshot area? (same on VC) @@ -7655,7 +7655,7 @@ CPed::CheckForGunShots(void) CPed * CPed::CheckForDeadPeds(void) { - int event; + int32 event; if (CEventList::FindClosestEvent(EVENT_DEAD_PED, GetPosition(), &event)) { int pedHandle = gaEvent[event].entityRef; if (pedHandle && gaEvent[event].entityType == EVENT_ENTITY_PED) { @@ -8047,7 +8047,7 @@ PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 firs if (!assoc || assoc->blendDelta < 0.0f) { int selectedAnimOffset; do - selectedAnimOffset = CGeneral::GetRandomNumberInRange(0, amount); + selectedAnimOffset = CGeneral::GetRandomNumberInRange(0, (int32)amount); while (assoc && first + selectedAnimOffset == assoc->animId); assoc = CAnimManager::BlendAnimation(ped->GetClump(), animGroup, (AnimationId)(first + selectedAnimOffset), 3.0f); @@ -9423,7 +9423,7 @@ CPed::HasAttractor(void) } void -CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float heading, float time, int32 qid) +CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float heading, float time, int qid) { if (!m_attractor) m_attractor = pAttractor; diff --git a/miami/peds/PlayerPed.cpp b/miami/peds/PlayerPed.cpp index b3fe0ff0..37618eda 100644 --- a/miami/peds/PlayerPed.cpp +++ b/miami/peds/PlayerPed.cpp @@ -2040,7 +2040,7 @@ CPlayerPed::PlayIdleAnimations(CPad *padUsed) if (!hasIdleAnim && !bIsLooking && !bIsRestoringLook && sinceLastInput - lastTime > 25000) { int anim; do - anim = CGeneral::GetRandomNumberInRange(0, ARRAY_SIZE(idleAnims)); + anim = CGeneral::GetRandomNumberInRange(0, (int32)ARRAY_SIZE(idleAnims)); while (lastAnim == anim); assoc = CAnimManager::BlendAnimation(GetClump(), idleAnims[anim].groupId, idleAnims[anim].animId, 8.0f); diff --git a/miami/peds/Population.cpp b/miami/peds/Population.cpp index 495cad16..248482a7 100644 --- a/miami/peds/Population.cpp +++ b/miami/peds/Population.cpp @@ -346,7 +346,7 @@ CPopulation::UpdatePedCount(ePedType pedType, bool decrease) } } -int +int32 CPopulation::ChooseGangOccupation(int gangId) { return CGangs::ChooseGangPedModel(gangId); @@ -620,7 +620,7 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree pedAmount = 1; CVector generatedCoors; - int node1, node2; + int32 node1, node2; float randomPos; bool foundCoors = !!ThePaths.GeneratePedCreationCoors(playerCentreOfWorld.x, playerCentreOfWorld.y, minDist, maxDist, minDistOffScreen, maxDistOffScreen, &generatedCoors, &node1, &node2, &randomPos, nil); @@ -1426,7 +1426,7 @@ CPopulation::ChooseCivilianCoupleOccupations(int32 group, int32& man, int32& wom } void -CPopulation::PlaceGangMembers(ePedType pedType, int pedAmount, CVector const& coors) +CPopulation::PlaceGangMembers(ePedType pedType, int32 pedAmount, CVector const& coors) { if (CGeneral::GetRandomNumberInRange(0.f, 1.f) < 0.333f) { PlaceGangMembersInFormation(pedType, pedAmount, coors); @@ -1436,7 +1436,7 @@ CPopulation::PlaceGangMembers(ePedType pedType, int pedAmount, CVector const& co } void -CPopulation::PlaceGangMembersInFormation(ePedType pedType, int pedAmount, CVector const& coors) +CPopulation::PlaceGangMembersInFormation(ePedType pedType, int32 pedAmount, CVector const& coors) { CPed *createdPeds[5]; @@ -1507,7 +1507,7 @@ CPopulation::PlaceGangMembersInFormation(ePedType pedType, int pedAmount, CVecto } void -CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector const& coors) +CPopulation::PlaceGangMembersInCircle(ePedType pedType, int32 pedAmount, CVector const& coors) { CPed *createdPeds[5]; diff --git a/miami/renderer/Fluff.cpp b/miami/renderer/Fluff.cpp index 59d3668d..7574a16d 100644 --- a/miami/renderer/Fluff.cpp +++ b/miami/renderer/Fluff.cpp @@ -387,7 +387,7 @@ CMovingThing CMovingThings::EndCloseList; int16 CMovingThings::Num; CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS]; -int32 CScrollBar::TonightsEvent; +int CScrollBar::TonightsEvent; void CMovingThings::Init() { diff --git a/miami/renderer/Font.cpp b/miami/renderer/Font.cpp index 6ae10011..606193b9 100644 --- a/miami/renderer/Font.cpp +++ b/miami/renderer/Font.cpp @@ -71,7 +71,7 @@ int16 CFont::Size[MAX_FONTS][210] = { 18, 10, 17, 17, 17, 17, 17, 15, 12, 16, 5, 30, 30, 30, 30, 30, // A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 12, 16, 19, 16, 19, 18, 18, 17, 22, 11, 17, 18, 18, 30, 22, 19, - //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, ¡, \, + //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, �, \, #ifdef FIX_BUGS 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 10, 19, #else @@ -81,11 +81,11 @@ int16 CFont::Size[MAX_FONTS][210] = { 12, 14, 11, 11, 16, 11, 12, 14, 14, 10, 13, 12, 10, 19, 18, 12, //p, q, r, s, t, u, v, w, x, y, z, ??, ??, ??, ??, ??, 16, 13, 13, 11, 12, 15, 12, 15, 13, 12, 12, 37, 33, 37, 35, 37, - //À, Á, Â, Ä, Æ, Ç, È, É, Ê, Ë, Ì, Í, Î, Ï, Ò, Ó, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 16, 16, 16, 16, 33, 17, 18, 18, 18, 18, 11, 11, 11, 11, 19, 19, - //Ô, Ö, Ù, Ú, Û, Ü, ß, à, á, â, ä, æ, ç, è, é, ê, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 19, 19, 19, 19, 19, 19, 15, 14, 14, 14, 14, 20, 14, 11, 11, 11, - //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, #ifdef FIX_BUGS 11, 10, 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 22, 18, 21, #else @@ -110,7 +110,7 @@ int16 CFont::Size[MAX_FONTS][210] = { 20, 7, 20, 20, 21, 20, 20, 19, 21, 20, 8, 30, 24, 30, 24, 19, //TM,A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 20, 22, 22, 21, 22, 18, 18, 22, 22, 9, 14, 21, 18, 27, 21, 24, - //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, ¡, °, + //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, �, �, #ifdef FIX_BUGS 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 7, 19, #else @@ -120,11 +120,11 @@ int16 CFont::Size[MAX_FONTS][210] = { 10, 17, 17, 16, 17, 17, 11, 17, 17, 7, 7, 18, 7, 25, 17, 17, //p, q, r, s, t, u, v, w, x, y, z, *I, *I, $2, (2, )2, 17, 17, 11, 17, 11, 17, 18, 25, 19, 18, 17, 28, 26, 20, 15, 15, - //À, Á, Â, Ä, Æ, Ç, È, É, Ê, Ë, Ì, Í, Î, Ï, Ò, Ó, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 20, 20, 20, 20, 29, 22, 19, 19, 19, 19, 9, 9, 9, 9, 23, 23, - //Ô, Ö, Ù, Ú, Û, Ü, ß, à, á, â, ä, æ, ç, è, é, ê, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 23, 23, 24, 24, 24, 24, 20, 19, 17, 17, 17, 30, 16, 17, 17, 17, - //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, #ifdef FIX_BUGS 17, 11, 11, 15, 12, 17, 17, 17, 17, 17, 17, 17, 17, 21, 17, 19, #else @@ -134,9 +134,9 @@ int16 CFont::Size[MAX_FONTS][210] = { 20, 18, 19, 19, 21, 19, 19, 19, 19, 19, 16, 19, 19, 19, 20, 19, //F2,G2,H2, I2, J2, K2, L2, M2, N2, O2, P2, Q2, R2, S2, T2, U2, 16, 19, 19, 9, 19, 20, 14, 29, 19, 19, 19, 19, 19, 19, 21, 19, - //V2,W2,X2, Y2, Z2, À2, Á2, Â2, Ä2, Æ2, Ç2, È2, É2, Ê2, Ë2, Ì2, + //V2,W2,X2, Y2, Z2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, 20, 32, 20, 19, 19, 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, - //Í2,Î2,Ï2, Ò2, Ó2, Ô2, Ö2, Ù2, Ú2, Û2, Ü2, ß2, Ñ2, ¿2, '2, .2, + //�2,�2,�2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, '2, .2, #ifdef FIX_BUGS 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 10, 9, #else @@ -191,17 +191,17 @@ int16 CFont::Size[MAX_FONTS][210] = { 18, 10, 17, 17, 17, 17, 17, 15, 12, 16, 5, 30, 30, 30, 30, 30, // A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 12, 16, 19, 16, 19, 18, 18, 17, 22, 11, 17, 18, 18, 30, 22, 19, - //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, ¡, \, + //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, �, \, 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 10, 19, //??,a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, 12, 14, 11, 11, 16, 11, 12, 14, 14, 10, 13, 12, 10, 19, 18, 12, //p, q, r, s, t, u, v, w, x, y, z, ??, ??, ??, ??, ??, 16, 13, 13, 11, 12, 15, 12, 15, 13, 12, 12, 37, 33, 37, 35, 37, - //À, Á, Â, Ä, Æ, Ç, È, É, Ê, Ë, Ì, Í, Î, Ï, Ò, Ó, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 16, 16, 16, 16, 33, 17, 18, 18, 18, 18, 11, 11, 11, 11, 19, 19, - //Ô, Ö, Ù, Ú, Û, Ü, ß, à, á, â, ä, æ, ç, è, é, ê, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 19, 19, 19, 19, 19, 19, 15, 14, 14, 14, 14, 20, 14, 11, 11, 11, - //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 11, 10, 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 22, 18, 21, //i,BLANKS 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, @@ -222,25 +222,25 @@ int16 CFont::Size[MAX_FONTS][210] = { 20, 7, 20, 20, 21, 20, 20, 19, 21, 20, 8, 30, 24, 30, 24, 19, //TM,A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, 20, 22, 22, 21, 22, 18, 18, 22, 22, 9, 14, 21, 18, 27, 21, 24, - //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, ¡, °, + //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, �, �, 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 7, 19, //(C),a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, 10, 17, 17, 16, 17, 17, 11, 17, 17, 7, 7, 18, 7, 25, 17, 17, //p, q, r, s, t, u, v, w, x, y, z, *I, *I, $2, (2, )2, 17, 17, 11, 17, 11, 17, 18, 25, 19, 18, 17, 28, 26, 20, 15, 15, - //À, Á, Â, Ä, Æ, Ç, È, É, Ê, Ë, Ì, Í, Î, Ï, Ò, Ó, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 20, 20, 20, 20, 29, 22, 19, 19, 19, 19, 9, 9, 9, 9, 23, 23, - //Ô, Ö, Ù, Ú, Û, Ü, ß, à, á, â, ä, æ, ç, è, é, ê, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 23, 23, 24, 24, 24, 24, 20, 19, 17, 17, 17, 30, 16, 17, 17, 17, - //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿, + //�, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, 17, 11, 11, 15, 12, 17, 17, 17, 17, 17, 17, 17, 17, 21, 17, 19, //02,12,22, 32, 42, 52, 62, 72, 82, 92, :2, A2, B2, C2, D2, E2, 20, 18, 19, 19, 21, 19, 19, 19, 19, 19, 16, 19, 19, 19, 20, 19, //F2,G2,H2, I2, J2, K2, L2, M2, N2, O2, P2, Q2, R2, S2, T2, U2, 16, 19, 19, 9, 19, 20, 14, 29, 19, 19, 19, 19, 19, 19, 21, 19, - //V2,W2,X2, Y2, Z2, À2, Á2, Â2, Ä2, Æ2, Ç2, È2, É2, Ê2, Ë2, Ì2, + //V2,W2,X2, Y2, Z2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, 20, 32, 20, 19, 19, 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, - //Í2,Î2,Ï2, Ò2, Ó2, Ô2, Ö2, Ù2, Ú2, Û2, Ü2, ß2, Ñ2, ¿2, '2, .2, + //�2,�2,�2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, �2, '2, .2, 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 10, 9, //space, unprop 10, 20 @@ -298,7 +298,7 @@ uint8 FontRenderStateBuf[1024]; #ifdef BUTTON_ICONS CSprite2d CFont::ButtonSprite[MAX_BUTTON_ICONS]; int CFont::PS2Symbol = BUTTON_NONE; -int CFont::ButtonsSlot = -1; +int32 CFont::ButtonsSlot = -1; #endif // BUTTON_ICONS void diff --git a/miami/rw/TexRead.cpp b/miami/rw/TexRead.cpp index 9a515219..da6ee7a0 100644 --- a/miami/rw/TexRead.cpp +++ b/miami/rw/TexRead.cpp @@ -37,6 +37,22 @@ int32 texNumLoaded; #define READNATIVE(stream, tex, size) RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, tex, size)) #endif +void RwTextureGtaStreamWrite(RwStream *stream, RwTexture* texture) +{ + auto fheader = stream->tell(); + // size will be written later + rw::writeChunkHeader(stream, rwID_TEXTURENATIVE, 0); + auto fbegin = stream->tell(); + + texture->streamWriteNative(stream); + + // rewrite header with correct size + auto fend = stream->tell(); + stream->seek(fheader, 0); + rw::writeChunkHeader(stream, rwID_TEXTURENATIVE, fend - fbegin); + stream->seek(fend, 0); +} + RwTexture* RwTextureGtaStreamRead(RwStream *stream) { diff --git a/miami/skel/crossplatform.cpp b/miami/skel/crossplatform.cpp index 58ab7920..b87fe09e 100644 --- a/miami/skel/crossplatform.cpp +++ b/miami/skel/crossplatform.cpp @@ -91,7 +91,9 @@ void GetDateFormat(int unused1, int unused2, SYSTEMTIME* in, int unused3, char* linuxTime.tm_hour = in->wHour; linuxTime.tm_min = in->wMinute; linuxTime.tm_sec = in->wSecond; - strftime(out, size, nl_langinfo(D_FMT), &linuxTime); + // strftime(out, size, nl_langinfo(D_FMT), &linuxTime); + printf("TODO: FIXME %s\n",__func__); + strcpy(out,"abc"); } void FileTimeToSystemTime(time_t* writeTime, SYSTEMTIME* out) { diff --git a/miami/skel/crossplatform.h b/miami/skel/crossplatform.h index 4ab7d156..f8d40036 100644 --- a/miami/skel/crossplatform.h +++ b/miami/skel/crossplatform.h @@ -79,6 +79,24 @@ void CapturePad(RwInt32 padID); void joysChangeCB(int jid, int event); #endif +#ifdef RW_DC +typedef struct +{ + RwBool fullScreen; + RwV2d lastMousePos; + double mouseWheel; // glfw doesn't cache it + bool cursorIsInWindow; + RwInt8 joy1id; + RwInt8 joy2id; +} +psGlobalType; + +#define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var) + +void CapturePad(RwInt32 padID); +void joysChangeCB(int jid, int event); +#endif + #ifdef DETECT_JOYSTICK_MENU extern char gSelectedJoystickName[128]; #endif @@ -135,7 +153,7 @@ void GetLocalTime_CP(SYSTEMTIME* out); #include #include #include -#include +// #include #include typedef void* HANDLE;