From 89879341235437f057e731e1bcdab05d4e341e9b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 17 Oct 2019 02:22:39 +0300 Subject: Full C3dMarkers --- src/core/FileLoader.h | 2 +- src/core/config.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h index f9121ace..ea7f47d9 100644 --- a/src/core/FileLoader.h +++ b/src/core/FileLoader.h @@ -9,7 +9,7 @@ public: static char *LoadLine(int fd); static RwTexDictionary *LoadTexDictionary(const char *filename); static void LoadCollisionFile(const char *filename); - static void LoadCollisionModel(uint8 *buf, CColModel &model, char *name); + static void LoadCollisionModel(uint8 *buf, struct CColModel &model, char *name); static void LoadModelFile(const char *filename); static RpAtomic *FindRelatedModelInfoCB(RpAtomic *atomic, void *data); static void LoadClumpFile(const char *filename); diff --git a/src/core/config.h b/src/core/config.h index 08ddd007..12cb7be8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -67,6 +67,7 @@ enum Config { NUMANTENNAS = 8, NUMCORONAS = 56, NUMPOINTLIGHTS = 32, + NUM3DMARKERS = 32, NUMMONEYMESSAGES = 16, NUMPICKUPMESSAGES = 16, -- cgit v1.2.3 From bc0ddc6b18405d4602a90edae02e98e8a001eab9 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 20 Oct 2019 20:31:59 +0300 Subject: CText encoding fixes --- src/core/Text.cpp | 276 ------------------------------------------------------ src/core/Text.h | 56 ----------- 2 files changed, 332 deletions(-) delete mode 100644 src/core/Text.cpp delete mode 100644 src/core/Text.h (limited to 'src/core') diff --git a/src/core/Text.cpp b/src/core/Text.cpp deleted file mode 100644 index dfa9815c..00000000 --- a/src/core/Text.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#include "common.h" -#include "patcher.h" -#include "FileMgr.h" -#include "Frontend.h" -#include "Messages.h" -#include "Text.h" - -static wchar WideErrorString[25]; - -CText &TheText = *(CText*)0x941520; - -CText::CText(void) -{ - keyArray.entries = nil; - keyArray.numEntries = 0; - data.chars = nil; - data.numChars = 0; - encoding = 101; - memset(WideErrorString, 0, sizeof(WideErrorString)); -} - -CText::~CText(void) -{ - data.Unload(); - keyArray.Unload(); -} - -void -CText::Load(void) -{ - uint8 *filedata; - char filename[32], type[4]; - int length; - int offset, sectlen; - - Unload(); - filedata = new uint8[0x40000]; - - CFileMgr::SetDir("TEXT"); - switch(CMenuManager::m_PrefsLanguage){ - case LANGUAGE_AMERICAN: - sprintf(filename, "AMERICAN.GXT"); - break; - case LANGUAGE_FRENCH: - sprintf(filename, "FRENCH.GXT"); - break; - case LANGUAGE_GERMAN: - sprintf(filename, "GERMAN.GXT"); - break; - case LANGUAGE_ITALIAN: - sprintf(filename, "ITALIAN.GXT"); - break; - case LANGUAGE_SPANISH: - sprintf(filename, "SPANISH.GXT"); - break; - } - - length = CFileMgr::LoadFile(filename, filedata, 0x40000, "rb"); - CFileMgr::SetDir(""); - - offset = 0; - while(offset < length){ - type[0] = filedata[offset++]; - type[1] = filedata[offset++]; - type[2] = filedata[offset++]; - type[3] = filedata[offset++]; - sectlen = (int)filedata[offset+3]<<24 | (int)filedata[offset+2]<<16 | - (int)filedata[offset+1]<<8 | (int)filedata[offset+0]; - offset += 4; - if(sectlen != 0){ - if(strncmp(type, "TKEY", 4) == 0) - keyArray.Load(sectlen, filedata, &offset); - else if(strncmp(type, "TDAT", 4) == 0) - data.Load(sectlen, filedata, &offset); - else - offset += sectlen; - } - } - - keyArray.Update(data.chars); - - delete[] filedata; -} - -void -CText::Unload(void) -{ - CMessages::ClearAllMessagesDisplayedByGame(); - data.Unload(); - keyArray.Unload(); -} - -wchar* -CText::Get(const char *key) -{ - return keyArray.Search(key); -} - -wchar -CText::GetUpperCase(wchar c) -{ - // TODO: do this depending on encoding - if(islower(c)) - return toupper(c); - return c; -} - -void -CText::UpperCase(wchar *s) -{ - while(*s){ - *s = GetUpperCase(*s); - s++; - } -} - - -void -CKeyArray::Load(uint32 length, uint8 *data, int *offset) -{ - uint32 i; - uint8 *rawbytes; - - numEntries = length / sizeof(CKeyEntry); - entries = new CKeyEntry[numEntries]; - rawbytes = (uint8*)entries; - - for(i = 0; i < length; i++) - rawbytes[i] = data[(*offset)++]; -} - -void -CKeyArray::Unload(void) -{ - delete[] entries; - entries = nil; - numEntries = 0; -} - -void -CKeyArray::Update(wchar *chars) -{ - int i; - for(i = 0; i < numEntries; i++) - entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value); -} - -CKeyEntry* -CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high) -{ - int mid; - int diff; - - if(low > high) - return nil; - - mid = (low + high)/2; - diff = strcmp(key, entries[mid].key); - if(diff == 0) - return &entries[mid]; - if(diff < 0) - return BinarySearch(key, entries, low, mid-1); - if(diff > 0) - return BinarySearch(key, entries, mid+1, high); - return nil; -} - -wchar* -CKeyArray::Search(const char *key) -{ - CKeyEntry *found; - char errstr[25]; - int i; - - found = BinarySearch(key, entries, 0, numEntries-1); - if(found) - return found->value; - sprintf(errstr, "%s missing", key); - for(i = 0; i < 25; i++) - WideErrorString[i] = errstr[i]; - return WideErrorString; -} - - -void -CData::Load(uint32 length, uint8 *data, int *offset) -{ - uint32 i; - uint8 *rawbytes; - - numChars = length / sizeof(wchar); - chars = new wchar[numChars]; - rawbytes = (uint8*)chars; - - for(i = 0; i < length; i++) - rawbytes[i] = data[(*offset)++]; -} - -void -CData::Unload(void) -{ - delete[] chars; - chars = nil; - numChars = 0; -} - -void -AsciiToUnicode(const char *src, uint16 *dst) -{ - while((*dst++ = *src++) != '\0'); -} - -char* -UnicodeToAscii(wchar *src) -{ - static char aStr[256]; - int len; - for(len = 0; src && *src != 0 && len < 256-1; len++, src++) - if(*src < 256) - aStr[len] = *src; - else - aStr[len] = '#'; - aStr[len] = '\0'; - return aStr; -} - -char* -UnicodeToAsciiForSaveLoad(wchar *src) -{ - // exact same code as above - static char aStr[256]; - int len; - for(len = 0; src && *src != 0 && len < 256-1; len++, src++) - if(*src < 256) - aStr[len] = *src; - else - aStr[len] = '#'; - aStr[len] = '\0'; - return aStr; -} - -void -UnicodeStrcpy(wchar *dst, const wchar *src) -{ - while((*dst++ = *src++) != '\0'); -} - -int -UnicodeStrlen(const wchar *str) -{ - int len; - for(len = 0; *str != 0; len++, str++); - return len; -} - -void -TextCopy(wchar *dst, const wchar *src) -{ - while((*dst++ = *src++) != '\0'); -} - - -STARTPATCHES - InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); - InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); - InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP); - - InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP); - InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP); - InjectHook(0x52BF80, &CKeyArray::Update, PATCH_JUMP); - InjectHook(0x52C060, &CKeyArray::BinarySearch, PATCH_JUMP); - InjectHook(0x52BFB0, &CKeyArray::Search, PATCH_JUMP); - - InjectHook(0x52C120, &CData::Load, PATCH_JUMP); - InjectHook(0x52C200, &CData::Unload, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Text.h b/src/core/Text.h deleted file mode 100644 index f554628c..00000000 --- a/src/core/Text.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -void AsciiToUnicode(const char *src, wchar *dst); -char *UnicodeToAscii(wchar *src); -char *UnicodeToAsciiForSaveLoad(wchar *src); -void UnicodeStrcpy(wchar *dst, const wchar *src); -int UnicodeStrlen(const wchar *str); -void TextCopy(wchar *dst, const wchar *src); - -struct CKeyEntry -{ - wchar *value; - char key[8]; -}; -// If this fails, CKeyArray::Load will have to be fixed -static_assert(sizeof(CKeyEntry) == 12, "CKeyEntry: error"); - -class CKeyArray -{ -public: - CKeyEntry *entries; - int numEntries; - - void Load(uint32 length, uint8 *data, int *offset); - void Unload(void); - void Update(wchar *chars); - CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); - wchar *Search(const char *key); -}; - -class CData -{ -public: - wchar *chars; - int numChars; - - void Load(uint32 length, uint8 *data, int *offset); - void Unload(void); -}; - -class CText -{ - CKeyArray keyArray; - CData data; - int8 encoding; -public: - CText(void); - ~CText(void); - void Load(void); - void Unload(void); - wchar *Get(const char *key); - wchar GetUpperCase(wchar c); - void UpperCase(wchar *s); -}; - -extern CText &TheText; -- cgit v1.2.3 From 383f70d1e7fe838b193f77d8a11400457a92f4ee Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 20 Oct 2019 20:33:16 +0300 Subject: Move Messages --- src/core/Messages.cpp | 26 ------------------------ src/core/Messages.h | 56 --------------------------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 src/core/Messages.cpp delete mode 100644 src/core/Messages.h (limited to 'src/core') diff --git a/src/core/Messages.cpp b/src/core/Messages.cpp deleted file mode 100644 index 9b5342ac..00000000 --- a/src/core/Messages.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "common.h" -#include "patcher.h" -#include "Messages.h" - -WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); } -WRAPPER void CMessages::ClearAllMessagesDisplayedByGame(void) { EAXJMP(0x52B670); } -WRAPPER int CMessages::WideStringCopy(wchar* dst, wchar* src, unsigned short size) { EAXJMP(0x5294B0); } -WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned short size) { EAXJMP(0x529510); } -WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); } -WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); } -WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); } -WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); } -WRAPPER void CMessages::AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AD10); } -WRAPPER void CMessages::AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AE00); } -WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); } -WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); } -WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); } -WRAPPER void CMessages::AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A850); } -WRAPPER void CMessages::AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A9A0); } -WRAPPER void CMessages::AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AAC0); } -WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); } -WRAPPER void CMessages::Init() { EAXJMP(0x529310); } -WRAPPER void CMessages::Process() { EAXJMP(0x529580); } -tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08; -tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0; -tBigMessage *CMessages::BIGMessages = (tBigMessage *)0x773628; diff --git a/src/core/Messages.h b/src/core/Messages.h deleted file mode 100644 index 7caf5786..00000000 --- a/src/core/Messages.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -struct tMessage -{ - wchar *m_pText; - uint16 m_nFlag; -private: - int8 _pad6[2]; -public: - uint32 m_nTime; - uint32 m_nStartTime; - int32 m_nNumber[6]; - wchar *m_pString; -}; - -struct tBigMessage -{ - tMessage m_Current; - tMessage m_Stack[3]; -}; - -struct tPreviousBrief -{ - wchar *m_pText; - int32 m_nNumber[6]; - wchar *m_pString; -}; - -class CMessages -{ -public: - static tPreviousBrief *PreviousBriefs; - static tMessage *BriefMessages; - static tBigMessage *BIGMessages; - -public: - static void Display(void); - static void ClearAllMessagesDisplayedByGame(void); - static int WideStringCopy(wchar* dst, wchar* src, unsigned short size); - static char WideStringCompare(wchar* str1, wchar* str2, unsigned short size); - static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst); - static void InsertPlayerControlKeysInString(wchar* src); - static int GetWideStringLength(wchar *src); - static void AddBigMessage(wchar* key, uint32 time, uint16 pos); - static void AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessage(wchar* key, uint32 time, uint16 pos); - static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos); - static void AddMessageSoon(wchar* key, uint32 time, uint16 pos); - static void AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6); - static void ClearMessages(); - static void Init(); - static void Process(); -}; -- cgit v1.2.3 From c97a28b3857b0ae589bb9032a1a43c5f6f8e46d2 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 20 Oct 2019 20:34:16 +0300 Subject: Full CPager --- src/core/User.cpp | 2 -- src/core/User.h | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/User.cpp b/src/core/User.cpp index 693333b7..600fa443 100644 --- a/src/core/User.cpp +++ b/src/core/User.cpp @@ -13,8 +13,6 @@ COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238; CPager& CUserDisplay::Pager = *(CPager*)0x8F2744; CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8; -WRAPPER void CPager::AddMessage(wchar*, uint16, uint16, uint16) { EAXJMP(0x52B940); } - WRAPPER void CUserDisplay::Process(void) { EAXJMP(0x4AD690); } void COnscreenTimer::Init() { diff --git a/src/core/User.h b/src/core/User.h index 27bb7f9e..90b2da55 100644 --- a/src/core/User.h +++ b/src/core/User.h @@ -1,5 +1,7 @@ #pragma once +#include "Pager.h" + class COnscreenTimerEntry { public: @@ -50,12 +52,6 @@ class CCurrentVehicle { }; -class CPager -{ -public: - void AddMessage(wchar*, uint16, uint16, uint16); -}; - class CUserDisplay { public: -- cgit v1.2.3 From e35780df43d5bd17f1e2a6ae731a63d034d1c5c4 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 21 Oct 2019 01:08:26 +0300 Subject: Full Messages --- src/core/ControllerConfig.cpp | 1 + src/core/ControllerConfig.h | 62 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index e3a586b2..6eef4d3d 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -22,6 +22,7 @@ WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); } WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); } WRAPPER void CControllerConfigManager::ClearSettingsAssociatedWithAction(int, int) { EAXJMP(0x58EB40); } +WRAPPER void CControllerConfigManager::GetWideStringOfCommandKeys(uint16, wchar*, uint16) { EAXJMP(0x58F460); } void CControllerConfigManager::LoadSettings(int32 file) { diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index b064a381..ab17577b 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -9,10 +9,64 @@ enum eControllerType OPTIONAL_EXTRA, MOUSE, JOYSTICK, + TOTAL_CONTROLLER_TYPES +}; + +enum e_ControllerAction +{ + PED_FIREWEAPON = 0, + PED_CYCLE_WEAPON_RIGHT, + PED_CYCLE_WEAPON_LEFT, + GO_FORWARD, + GO_BACK, + GO_LEFT, + GO_RIGHT, + PED_SNIPER_ZOOM_IN, + PED_SNIPER_ZOOM_OUT, + VEHICLE_ENTER_EXIT, + CAMERA_CHANGE_VIEW_ALL_SITUATIONS, + PED_JUMPING, + PED_SPRINT, + PED_LOOKBEHIND, + //PED_DUCK, // VC + //PED_ANSWER_PHONE, // VC + VEHICLE_ACCELERATE, + VEHICLE_BRAKE, + VEHICLE_CHANGE_RADIO_STATION, + VEHICLE_HORN, + TOGGLE_SUBMISSIONS, + VEHICLE_HANDBRAKE, + PED_1RST_PERSON_LOOK_LEFT, + PED_1RST_PERSON_LOOK_RIGHT, + VEHICLE_LOOKLEFT, + VEHICLE_LOOKRIGHT, + VEHICLE_LOOKBEHIND, + VEHICLE_TURRETLEFT, + VEHICLE_TURRETRIGHT, + VEHICLE_TURRETUP, + VEHICLE_TURRETDOWN, + PED_CYCLE_TARGET_LEFT, + PED_CYCLE_TARGET_RIGHT, + PED_CENTER_CAMERA_BEHIND_PLAYER, + PED_LOCK_TARGET, + NETWORK_TALK, + PED_1RST_PERSON_LOOK_UP, + PED_1RST_PERSON_LOOK_DOWN, + + CONTROLLERACTION_36, // unk, unused? + + TOGGLE_DPAD, + SWITCH_DEBUG_CAM_ON, + TAKE_SCREEN_SHOT, + SHOW_MOUSE_POINTER_TOGGLE, + + TOTAL_CONTROL_ACTIONS }; class CMouseControllerState; +#define ACTIONNAME_LENGTH 40 + class CControllerConfigManager { public: @@ -23,16 +77,13 @@ public: }; bool firstCapture; - char _pad0[3]; DIJOYSTATE2 m_OldState; DIJOYSTATE2 m_NewState; - wchar m_aActionNames[41][40]; + wchar m_aActionNames[TOTAL_CONTROL_ACTIONS][ACTIONNAME_LENGTH]; bool m_aButtonStates[17]; - char _pad1[3]; - tControllerConfigBind m_aSettings[41][4]; + tControllerConfigBind m_aSettings[TOTAL_CONTROL_ACTIONS][TOTAL_CONTROLLER_TYPES]; uint8 m_aSimCheckers[4][4]; bool m_bMouseAssociated; - char _pad2[3]; void UpdateJoyButtonState(int padnumber); void UpdateJoyInConfigMenus_ButtonDown(int button, int padnumber); @@ -52,6 +103,7 @@ public: void AffectPadFromMouse(); void ClearSettingsAssociatedWithAction(int, int); + void GetWideStringOfCommandKeys(uint16, wchar*, uint16); }; VALIDATE_SIZE(CControllerConfigManager, 0x143C); -- cgit v1.2.3 From 2d998b24163060e225481d0f9a59092fa0981db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 25 Oct 2019 02:25:11 +0300 Subject: Fixes&Peds --- src/core/Game.cpp | 3 +++ src/core/re3.cpp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src/core') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 00d50fa8..b2bac8dd 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -80,12 +80,15 @@ WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); } #if 0 WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); } #else +extern void (*DebugMenuProcess)(void); void CGame::Process(void) { CPad::UpdatePads(); TheCamera.SetMotionBlurAlpha(0); if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); + + DebugMenuProcess(); CCutsceneMgr::Update(); if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused()) FrontEndMenuManager.Process(); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index c8b50d55..62e9a040 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -18,6 +18,7 @@ #include "Automobile.h" #include "Ped.h" #include "debugmenu_public.h" +#include "Particle.h" #include #include @@ -352,6 +353,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou); #ifndef MASTER DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil); + DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil); #endif DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); -- cgit v1.2.3 From 12ee71e4f732c883b33b9165c448302ea726186b Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 30 Aug 2019 00:44:57 +0200 Subject: audio7 --- src/core/common.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/common.h b/src/core/common.h index 920b7108..0a2e6768 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -121,7 +121,7 @@ public: CRGBA(void) { } CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { } - CRGBA &CRGBA::operator =(const CRGBA &right) + CRGBA &operator =(const CRGBA &right) { this->r = right.r; this->g = right.g; @@ -142,7 +142,7 @@ public: return rwRGBA; } - CRGBA &CRGBA::operator =(const RwRGBA &right) + CRGBA &operator =(const RwRGBA &right) { this->r = right.red; this->g = right.green; @@ -197,8 +197,8 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#define min(a, b) (((a) < (b)) ? (a) : (b)) +auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); }; +auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); }; #define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) -- cgit v1.2.3 From 003ac856c6e239722241c40358ea91d3c5e64c3a Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sat, 21 Sep 2019 22:10:35 +0200 Subject: More work --- src/core/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/common.h b/src/core/common.h index 0a2e6768..d3d4e049 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -197,8 +197,8 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) -auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); }; -auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); }; +//auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); }; +//auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); }; #define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) -- cgit v1.2.3 From d2941b03689575fc0158683daae7883402a92651 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 24 Sep 2019 13:33:16 +0200 Subject: More audio (to hook and test) --- src/core/AnimViewer.cpp | 2 +- src/core/FileLoader.cpp | 2 +- src/core/Lists.h | 2 ++ src/core/World.cpp | 2 +- src/core/main.cpp | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 86b22ec5..84de3fe8 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -255,7 +255,7 @@ CAnimViewer::Update(void) if (modelInfo->m_type == MITYPE_VEHICLE) { CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo; - if (veh->m_vehicleType != VEHICLE_TYPE_CAR) { + if (veh->m_vehicleType != VEHICLE_TYPE_AUTOMOBILE) { // Not ready yet /* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) { diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 6f3b0971..f7b69dea 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -738,7 +738,7 @@ CFileLoader::LoadVehicleObject(const char *line) if(strncmp(type, "car", 4) == 0){ mi->m_wheelId = misc; mi->m_wheelScale = wheelScale; - mi->m_vehicleType = VEHICLE_TYPE_CAR; + mi->m_vehicleType = VEHICLE_TYPE_AUTOMOBILE; }else if(strncmp(type, "boat", 5) == 0){ mi->m_vehicleType = VEHICLE_TYPE_BOAT; }else if(strncmp(type, "train", 6) == 0){ diff --git a/src/core/Lists.h b/src/core/Lists.h index 7572e882..ecf24740 100644 --- a/src/core/Lists.h +++ b/src/core/Lists.h @@ -1,5 +1,7 @@ #pragma once +#include "common.h" + class CPtrNode { public: diff --git a/src/core/World.cpp b/src/core/World.cpp index 5dea09bd..46d36348 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -793,7 +793,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad *eCol, &ms_testSpherePoint, nil, nil); if (collidedSpheres != 0 || - (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR && + (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_AUTOMOBILE && e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) { return e; } diff --git a/src/core/main.cpp b/src/core/main.cpp index 8985d56a..3c9556d4 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -339,7 +339,7 @@ void RenderEffects(void) { CGlass::Render(); - CWaterCannons::Render(); + CWaterCannon::Render(); CSpecialFX::Render(); CShadows::RenderStaticShadows(); CShadows::RenderStoredShadows(); -- cgit v1.2.3 From d822417cfce5ce0120481bd37271ebde6117b14c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 13 Oct 2019 00:35:01 +0200 Subject: Fixes for nitpicks --- src/core/common.h | 18 ++++++++---------- src/core/main.cpp | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/core') diff --git a/src/core/common.h b/src/core/common.h index d3d4e049..a538ddb6 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -197,8 +197,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) -//auto max = [](auto a, auto b) { return ((a) > (b)) ? (a) : (b); }; -//auto min = [](auto a, auto b) { return ((a) < (b)) ? (a) : (b); }; #define ABS(a) (((a) < 0) ? (-(a)) : (a)) #define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min))))) @@ -337,7 +335,7 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip) template inline const T ReadSaveBuf(uint8 *&buf) -{ +{ T &value = *(T*)buf; SkipSaveBuf(buf, sizeof(T)); return value; @@ -345,8 +343,8 @@ inline const T ReadSaveBuf(uint8 *&buf) template inline T *WriteSaveBuf(uint8 *&buf, const T &value) -{ - T *p = (T*)buf; +{ + T *p = (T*)buf; *p = value; SkipSaveBuf(buf, sizeof(T)); return p; @@ -355,11 +353,11 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value) #define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32)) -#define WriteSaveHeader(buf,a,b,c,d,size) \ - WriteSaveBuf(buf, a);\ - WriteSaveBuf(buf, b);\ - WriteSaveBuf(buf, c);\ - WriteSaveBuf(buf, d);\ +#define WriteSaveHeader(buf,a,b,c,d,size) \ + WriteSaveBuf(buf, a);\ + WriteSaveBuf(buf, b);\ + WriteSaveBuf(buf, c);\ + WriteSaveBuf(buf, d);\ WriteSaveBuf(buf, size); #define CheckSaveHeader(buf,a,b,c,d,size)\ diff --git a/src/core/main.cpp b/src/core/main.cpp index 3c9556d4..8985d56a 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -339,7 +339,7 @@ void RenderEffects(void) { CGlass::Render(); - CWaterCannon::Render(); + CWaterCannons::Render(); CSpecialFX::Render(); CShadows::RenderStaticShadows(); CShadows::RenderStoredShadows(); -- cgit v1.2.3 From 8808e6fdfe5604022a64e72df3ee60d8ed10e9d6 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 25 Oct 2019 18:39:26 +0200 Subject: Fixes for aap review (audio8) --- src/core/AnimViewer.cpp | 2 +- src/core/FileLoader.cpp | 2 +- src/core/World.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 84de3fe8..86b22ec5 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -255,7 +255,7 @@ CAnimViewer::Update(void) if (modelInfo->m_type == MITYPE_VEHICLE) { CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo; - if (veh->m_vehicleType != VEHICLE_TYPE_AUTOMOBILE) { + if (veh->m_vehicleType != VEHICLE_TYPE_CAR) { // Not ready yet /* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) { diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index f7b69dea..6f3b0971 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -738,7 +738,7 @@ CFileLoader::LoadVehicleObject(const char *line) if(strncmp(type, "car", 4) == 0){ mi->m_wheelId = misc; mi->m_wheelScale = wheelScale; - mi->m_vehicleType = VEHICLE_TYPE_AUTOMOBILE; + mi->m_vehicleType = VEHICLE_TYPE_CAR; }else if(strncmp(type, "boat", 5) == 0){ mi->m_vehicleType = VEHICLE_TYPE_BOAT; }else if(strncmp(type, "train", 6) == 0){ diff --git a/src/core/World.cpp b/src/core/World.cpp index 46d36348..5dea09bd 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -793,7 +793,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad *eCol, &ms_testSpherePoint, nil, nil); if (collidedSpheres != 0 || - (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_AUTOMOBILE && + (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR && e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) { return e; } -- cgit v1.2.3 From 832572664c594e060813c46860fc71b0a2ac1710 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 26 Oct 2019 14:40:52 +0300 Subject: Added timing to RwTextureGtaStreamRead --- src/core/RwTexRead.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/RwTexRead.cpp b/src/core/RwTexRead.cpp index a1a7050a..6b717b34 100644 --- a/src/core/RwTexRead.cpp +++ b/src/core/RwTexRead.cpp @@ -1,5 +1,15 @@ +#pragma warning( push ) +#pragma warning( disable : 4005) +#define DIRECTINPUT_VERSION 0x0800 +#include +#pragma warning( pop ) #include "common.h" +#include "win.h" #include "patcher.h" +#include "Timer.h" + +float &texLoadTime = *(float*)0x8F1B50; +int32 &texNumLoaded = *(int32*)0x8F252C; RwTexture* RwTextureGtaStreamRead(RwStream *stream) @@ -10,11 +20,15 @@ RwTextureGtaStreamRead(RwStream *stream) if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version)) return nil; - // TODO: unused timing + float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size))) return nil; - + + if (gGameState == GS_INIT_PLAYING_GAME) { + texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); + texNumLoaded++; + } return tex; } -- cgit v1.2.3 From d5a72fa597e7d0885f7a398e204c4085aff5c241 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 26 Oct 2019 15:20:12 +0300 Subject: Audio stuff moved around, removed MusicManager dependencies, eMusicMode used for ChangeMusicMode --- src/core/CutsceneMgr.cpp | 5 ++--- src/core/Frontend.cpp | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp index 95abfcc9..f147e8c9 100644 --- a/src/core/CutsceneMgr.cpp +++ b/src/core/CutsceneMgr.cpp @@ -17,7 +17,6 @@ #include "RpAnimBlend.h" #include "ModelIndices.h" #include "TempColModels.h" -#include "MusicManager.h" const struct { const char *szTrackName; @@ -209,7 +208,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) CFileMgr::CloseFile(file); if (strcmpi(ms_cutsceneName, "end")) { - DMAudio.ChangeMusicMode(2); + DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE); int trackId = FindCutsceneAudioTrackId(szCutsceneName); if (trackId != -1) { printf("Start preload audio %s\n", szCutsceneName); @@ -368,7 +367,7 @@ CCutsceneMgr::DeleteCutsceneData(void) if (strcmpi(ms_cutsceneName, "end")) { DMAudio.StopCutSceneMusic(); if (strcmpi(ms_cutsceneName, "bet")) - DMAudio.ChangeMusicMode(1); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); } CTimer::Stop(); //TheCamera.GetScreenFadeStatus() == 2; // what for?? diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 0be25e8a..6ba6d5c8 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -11,7 +11,6 @@ #include "Timer.h" #include "Game.h" #include "DMAudio.h" -#include "MusicManager.h" #include "FileMgr.h" #include "Streaming.h" #include "TxdStore.h" @@ -535,7 +534,7 @@ void CMenuManager::Draw() if (m_nPrefsAudio3DProviderIndex == -1) textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_NAH"); else { - char *provider = MusicManager.Get3DProviderName(m_nPrefsAudio3DProviderIndex); + char *provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex); AsciiToUnicode(provider, gUString); textToPrint[MENUCOLUMN_RIGHT] = gUString; } -- cgit v1.2.3 From 428b407ad5e420dedc7211227de73490a2503d23 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 26 Oct 2019 16:02:59 +0300 Subject: A bit more enums for ChangeMusicMode --- src/core/Frontend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 6ba6d5c8..5f87049a 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1085,7 +1085,7 @@ void CMenuManager::LoadAllTextures() { if (!m_bSpritesLoaded) { CMenuManager::CentreMousePointer(); - DMAudio.ChangeMusicMode(0); + DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0); m_nCurrOption = 0; m_PrefsRadioStation = DMAudio.GetRadioInCar(); @@ -2132,7 +2132,7 @@ WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); } void CMenuManager::RequestFrontEndShutdown() { m_bShutDownFrontEndRequested = true; - DMAudio.ChangeMusicMode(1); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); } #endif -- cgit v1.2.3