Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-05-19 12:44:40 +03:00
commit ff0e039599
9 changed files with 246 additions and 204 deletions

View File

@ -1,4 +1,5 @@
#include "common.h" #include "common.h"
#include <ctype.h>
#include "main.h" #include "main.h"
#include "Quaternion.h" #include "Quaternion.h"
@ -26,6 +27,9 @@
#include "FileLoader.h" #include "FileLoader.h"
#include "Streaming.h" #include "Streaming.h"
#include "ColStore.h" #include "ColStore.h"
#include "Occlusion.h"
//--MIAMI: file done
char CFileLoader::ms_line[256]; char CFileLoader::ms_line[256];
@ -159,7 +163,6 @@ struct ColHeader
uint32 size; uint32 size;
}; };
//--MIAMI: done
void void
CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot) CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
{ {
@ -196,7 +199,6 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
} }
//--MIAMI: done
bool bool
CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot) CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot)
{ {
@ -298,13 +300,15 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
model.numLines = *(int16*)buf; model.numLines = *(int16*)buf;
buf += 4; buf += 4;
if(model.numLines > 0){ if(model.numLines > 0){
model.lines = (CColLine*)RwMalloc(model.numLines*sizeof(CColLine)); //model.lines = (CColLine*)RwMalloc(model.numLines*sizeof(CColLine));
for(i = 0; i < model.numLines; i++){ for(i = 0; i < model.numLines; i++){
model.lines[i].Set(*(CVector*)buf, *(CVector*)(buf+12)); //model.lines[i].Set(*(CVector*)buf, *(CVector*)(buf+12));
buf += 24; buf += 24;
} }
}else }else
model.lines = nil; model.lines = nil;
model.numLines = 0;
model.lines = nil;
model.numBoxes = *(int16*)buf; model.numBoxes = *(int16*)buf;
buf += 4; buf += 4;
@ -323,10 +327,12 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
model.vertices = (CVector*)RwMalloc(numVertices*sizeof(CVector)); model.vertices = (CVector*)RwMalloc(numVertices*sizeof(CVector));
for(i = 0; i < numVertices; i++){ for(i = 0; i < numVertices; i++){
model.vertices[i] = *(CVector*)buf; model.vertices[i] = *(CVector*)buf;
#if 0
if(Abs(model.vertices[i].x) >= 256.0f || if(Abs(model.vertices[i].x) >= 256.0f ||
Abs(model.vertices[i].y) >= 256.0f || Abs(model.vertices[i].y) >= 256.0f ||
Abs(model.vertices[i].z) >= 256.0f) Abs(model.vertices[i].z) >= 256.0f)
printf("%s:Collision volume too big\n", modelname); printf("%s:Collision volume too big\n", modelname);
#endif
buf += 12; buf += 12;
} }
}else }else
@ -349,7 +355,7 @@ GetNameAndLOD(char *nodename, char *name, int *n)
{ {
char *underscore = nil; char *underscore = nil;
for(char *s = nodename; *s != '\0'; s++){ for(char *s = nodename; *s != '\0'; s++){
if(s[0] == '_' && (s[1] == 'l' || s[1] == 'L')) if(s[0] == '_' && (s[1] == 'l' || s[1] == 'L') && isdigit(s[2]))
underscore = s; underscore = s;
} }
if(underscore){ if(underscore){
@ -1093,7 +1099,7 @@ CFileLoader::LoadScene(const char *filename)
LoadCullZone(line); LoadCullZone(line);
break; break;
case OCCL: case OCCL:
// TODO(MIAMI): occlusion LoadOcclusionVolume(line);
break; break;
case PICK: case PICK:
// unused // unused
@ -1187,7 +1193,9 @@ CFileLoader::LoadObjectInstance(const char *line)
CColStore::GetBoundingBox(col->level).ContainRect(entity->GetBoundRect()); CColStore::GetBoundingBox(col->level).ContainRect(entity->GetBoundRect());
}else }else
entity->bUsesCollision = false; entity->bUsesCollision = false;
// TODO(MIAMI): set some flag here if col min is below 6
if(entity->GetPosition().z + col->boundingBox.min.z < 6.0f)
entity->bUnderwater = true;
}else{ }else{
entity = new CDummyObject; entity = new CDummyObject;
entity->SetModelIndexNoCreate(id); entity->SetModelIndexNoCreate(id);
@ -1241,6 +1249,21 @@ CFileLoader::LoadPickup(const char *line)
sscanf(line, "%d %f %f %f", &id, &x, &y, &z); sscanf(line, "%d %f %f %f", &id, &x, &y, &z);
} }
void
CFileLoader::LoadOcclusionVolume(const char *line)
{
float x, y, z;
float width, length, height;
float angle;
sscanf(line, "%f %f %f %f %f %f %f",
&x, &y, &z,
&width, &length, &height,
&angle);
COcclusion::AddOne(x, y, z, width, length, z + height/2.0f, angle);
}
//--MIAMI: unused //--MIAMI: unused
void void
CFileLoader::ReloadPaths(const char *filename) CFileLoader::ReloadPaths(const char *filename)

View File

@ -39,6 +39,7 @@ public:
static void LoadZone(const char *line); static void LoadZone(const char *line);
static void LoadCullZone(const char *line); static void LoadCullZone(const char *line);
static void LoadPickup(const char *line); static void LoadPickup(const char *line);
static void LoadOcclusionVolume(const char *line);
static void ReloadPaths(const char *filename); static void ReloadPaths(const char *filename);
static void ReloadObjectTypes(const char *filename); static void ReloadObjectTypes(const char *filename);

View File

@ -149,53 +149,7 @@ bool CMenuManager::m_PrefsMarketing = false;
bool CMenuManager::m_PrefsDisableTutorials = false; bool CMenuManager::m_PrefsDisableTutorials = false;
#endif // !MASTER #endif // !MASTER
// 0x5F311C /*
const char* FrontendFilenames[][2] = {
{"fe2_mainpanel_ul", "" },
{"fe2_mainpanel_ur", "" },
{"fe2_mainpanel_dl", "" },
{"fe2_mainpanel_dr", "" },
{"fe2_mainpanel_dr2", "" },
{"fe2_tabactive", "" },
{"fe_iconbrief", "" },
{"fe_iconstats", "" },
{"fe_iconcontrols", "" },
{"fe_iconsave", "" },
{"fe_iconaudio", "" },
{"fe_icondisplay", "" },
{"fe_iconlanguage", "" },
{"fe_controller", "" },
{"fe_controllersh", "" },
{"fe_arrows1", "" },
{"fe_arrows2", "" },
{"fe_arrows3", "" },
{"fe_arrows4", "" },
{"fe_radio1", "" },
{"fe_radio2", "" },
{"fe_radio3", "" },
{"fe_radio4", "" },
{"fe_radio5", "" },
{"fe_radio6", "" },
{"fe_radio7", "" },
{"fe_radio8", "" },
{"fe_radio9", "" },
};
#ifdef MENU_MAP
const char* MapFilenames[][2] = {
{"mapMid01", "mapMid01A"},
{"mapMid02", "mapMid02A"},
{"mapMid03", "mapMid03A"},
{"mapBot01", "mapBot01A"},
{"mapBot02", "mapBot02A"},
{"mapBot03", "mapBot03A"},
{"mapTop01", "mapTop01A"},
{"mapTop02", "mapTop02A"},
{"mapTop03", "mapTop03A"},
};
CSprite2d CMenuManager::m_aMapSprites[NUM_MAP_SPRITES];
#endif
// 0x5F3344 // 0x5F3344
const char* MenuFilenames[][2] = { const char* MenuFilenames[][2] = {
{"connection24", ""}, {"connection24", ""},
@ -219,6 +173,37 @@ const char* MenuFilenames[][2] = {
{"gta3logo256", "gta3logo256m"}, {"gta3logo256", "gta3logo256m"},
{ nil, nil } { nil, nil }
}; };
*/
// 0x68C144
const char* FrontendFilenames[][2] = {
{"background", ""},
{"vc_logo", "vc_logom"},
{"mouse", "mousea"},
{"mapTop01", "mapTop01A"},
{"mapTop02", "mapTop02A"},
{"mapTop03", "mapTop03A"},
{"mapMid01", "mapMid01A"},
{"mapMid02", "mapMid02A"},
{"mapMid03", "mapMid03A"},
{"mapBot01", "mapBot01A"},
{"mapBot02", "mapBot02A"},
{"mapBot03", "mapBot03A"},
{"wildstyle", "wildstyleA"},
{"flash", "flashA"},
{"kchat", "kchatA"},
{"fever", "feverA"},
{"vrock", "vrockA"},
{"vcpr", "vcprA"},
{"espantoso", "espantosoA"},
{"emotion", "emotionA"},
{"wave", "waveA"},
{"mp3", "mp3A"},
{"downOff", "buttonA"},
{"downOn", "buttonA"},
{"upOff", "buttonA"},
{"upOn", "buttonA"}
};
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
// All of the defines below replace the StretchX function. Otherwise use SCREEN_SCALE_X. // All of the defines below replace the StretchX function. Otherwise use SCREEN_SCALE_X.
@ -1332,7 +1317,7 @@ CMenuManager::Draw()
ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO9], MENU_X_LEFT_ALIGNED(480.0f), MENU_Y(nextYToUse), 8, HOVEROPTION_RADIO_8); ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO9], MENU_X_LEFT_ALIGNED(480.0f), MENU_Y(nextYToUse), 8, HOVEROPTION_RADIO_8);
if (DMAudio.IsMP3RadioChannelAvailable()) if (DMAudio.IsMP3RadioChannelAvailable())
ProcessRadioIcon(m_aMenuSprites[MENUSPRITE_MP3LOGO], MENU_X_LEFT_ALIGNED(540.0f), MENU_Y(nextYToUse), 9, HOVEROPTION_RADIO_9); ProcessRadioIcon(m_aFrontEndSprites[MENUSPRITE_MP3], MENU_X_LEFT_ALIGNED(540.0f), MENU_Y(nextYToUse), 9, HOVEROPTION_RADIO_9);
nextYToUse += 70.0f; nextYToUse += 70.0f;
} }
@ -2079,13 +2064,13 @@ CMenuManager::DrawFrontEndSaveZone()
mouse.Translate(m_nMousePosX, m_nMousePosY); mouse.Translate(m_nMousePosX, m_nMousePosY);
shad.Translate(m_nMousePosX, m_nMousePosY); shad.Translate(m_nMousePosX, m_nMousePosY);
if(field_518 == 4){ if(field_518 == 4){
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
}else{ }else{
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
} }
} }
} }
@ -2273,13 +2258,13 @@ CMenuManager::DrawFrontEndNormal()
mouse.Translate(m_nMousePosX, m_nMousePosY); mouse.Translate(m_nMousePosX, m_nMousePosY);
shad.Translate(m_nMousePosX, m_nMousePosY); shad.Translate(m_nMousePosX, m_nMousePosY);
if(field_518 == 4){ if(field_518 == 4){
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255));
}else{ }else{
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
} }
} }
} }
@ -2293,65 +2278,24 @@ CMenuManager::DrawFrontEndNormal()
LoadSplash(nil); LoadSplash(nil);
eMenuSprites previousSprite; eMenuSprites previousSprite = MENUSPRITE_BACKGROUND;
if (m_nMenuFadeAlpha < 255) {
switch (m_nPrevScreen) {
case MENUPAGE_STATS:
case MENUPAGE_START_MENU:
case MENUPAGE_PAUSE_MENU:
previousSprite = MENUSPRITE_MAINMENU;
break;
case MENUPAGE_NEW_GAME:
case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT:
case MENUPAGE_NEW_GAME_RELOAD:
case MENUPAGE_LOAD_SLOT_CONFIRM:
case MENUPAGE_DELETE_SLOT_CONFIRM:
case MENUPAGE_EXIT:
previousSprite = MENUSPRITE_SINGLEPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAIN:
previousSprite = MENUSPRITE_MULTIPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAP:
case MENUPAGE_MULTIPLAYER_FIND_GAME:
case MENUPAGE_SKIN_SELECT:
case MENUPAGE_KEYBOARD_CONTROLS:
case MENUPAGE_MOUSE_CONTROLS:
previousSprite = MENUSPRITE_FINDGAME;
break;
case MENUPAGE_MULTIPLAYER_CONNECTION:
case MENUPAGE_MULTIPLAYER_MODE:
previousSprite = MENUSPRITE_CONNECTION;
break;
case MENUPAGE_MULTIPLAYER_CREATE:
previousSprite = MENUSPRITE_HOSTGAME;
break;
case MENUPAGE_SKIN_SELECT_OLD:
case MENUPAGE_OPTIONS:
previousSprite = MENUSPRITE_PLAYERSET;
break;
default:
previousSprite = MENUSPRITE_MAINMENU;
break;
}
if (m_nMenuFadeAlpha < 255) {
if (m_nPrevScreen == m_nCurrScreen) if (m_nPrevScreen == m_nCurrScreen)
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255 - m_nMenuFadeAlpha)); CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255 - m_nMenuFadeAlpha));
else else
m_aMenuSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255 - m_nMenuFadeAlpha)); m_aFrontEndSprites[previousSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255 - m_nMenuFadeAlpha));
} }
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
eMenuSprites currentSprite = MENUSPRITE_MAINMENU; // actually uninitialized eMenuSprites currentSprite = MENUSPRITE_BACKGROUND; // actually uninitialized
switch (m_nCurrScreen) { switch (m_nCurrScreen) {
case MENUPAGE_STATS: case MENUPAGE_STATS:
case MENUPAGE_START_MENU: case MENUPAGE_START_MENU:
case MENUPAGE_PAUSE_MENU: case MENUPAGE_PAUSE_MENU:
currentSprite = MENUSPRITE_MAINMENU;
break;
case MENUPAGE_NEW_GAME: case MENUPAGE_NEW_GAME:
case MENUPAGE_CHOOSE_LOAD_SLOT: case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT: case MENUPAGE_CHOOSE_DELETE_SLOT:
@ -2359,28 +2303,18 @@ CMenuManager::DrawFrontEndNormal()
case MENUPAGE_LOAD_SLOT_CONFIRM: case MENUPAGE_LOAD_SLOT_CONFIRM:
case MENUPAGE_DELETE_SLOT_CONFIRM: case MENUPAGE_DELETE_SLOT_CONFIRM:
case MENUPAGE_EXIT: case MENUPAGE_EXIT:
currentSprite = MENUSPRITE_SINGLEPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAIN: case MENUPAGE_MULTIPLAYER_MAIN:
currentSprite = MENUSPRITE_MULTIPLAYER;
break;
case MENUPAGE_MULTIPLAYER_MAP: case MENUPAGE_MULTIPLAYER_MAP:
case MENUPAGE_MULTIPLAYER_FIND_GAME: case MENUPAGE_MULTIPLAYER_FIND_GAME:
case MENUPAGE_SKIN_SELECT: case MENUPAGE_SKIN_SELECT:
case MENUPAGE_KEYBOARD_CONTROLS: case MENUPAGE_KEYBOARD_CONTROLS:
case MENUPAGE_MOUSE_CONTROLS: case MENUPAGE_MOUSE_CONTROLS:
currentSprite = MENUSPRITE_FINDGAME;
break;
case MENUPAGE_MULTIPLAYER_CONNECTION: case MENUPAGE_MULTIPLAYER_CONNECTION:
case MENUPAGE_MULTIPLAYER_MODE: case MENUPAGE_MULTIPLAYER_MODE:
currentSprite = MENUSPRITE_CONNECTION;
break;
case MENUPAGE_MULTIPLAYER_CREATE: case MENUPAGE_MULTIPLAYER_CREATE:
currentSprite = MENUSPRITE_HOSTGAME;
break;
case MENUPAGE_SKIN_SELECT_OLD: case MENUPAGE_SKIN_SELECT_OLD:
case MENUPAGE_OPTIONS: case MENUPAGE_OPTIONS:
currentSprite = MENUSPRITE_PLAYERSET; currentSprite = MENUSPRITE_BACKGROUND;
break; break;
} }
@ -2404,13 +2338,13 @@ CMenuManager::DrawFrontEndNormal()
#endif #endif
if (m_nMenuFadeAlpha > 255){ if (m_nMenuFadeAlpha > 255){
m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
} else { } else {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, m_nMenuFadeAlpha)); m_aFrontEndSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, m_nMenuFadeAlpha));
} }
} else { } else {
m_aMenuSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
// TODO: what is this? waiting mouse? // TODO: what is this? waiting mouse?
if(field_518 == 4){ if(field_518 == 4){
if(m_nHoverOption == HOVEROPTION_3 || m_nHoverOption == HOVEROPTION_4 || if(m_nHoverOption == HOVEROPTION_3 || m_nHoverOption == HOVEROPTION_4 ||
@ -2422,14 +2356,16 @@ CMenuManager::DrawFrontEndNormal()
} }
} }
m_aFrontEndSprites[currentSprite].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
// GTA LOGO // GTA LOGO
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) { if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame) if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
m_aMenuSprites[MENUSPRITE_GTA3LOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(205.0f), MENU_Y(70.0f), MENU_X_LEFT_ALIGNED(435.0f), MENU_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255))); m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(205.0f), MENU_Y(70.0f), MENU_X_LEFT_ALIGNED(435.0f), MENU_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255)));
else else
m_aMenuSprites[MENUSPRITE_GTALOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(225.0f), MENU_Y(40.0f), MENU_X_LEFT_ALIGNED(415.0f), MENU_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255))); m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(225.0f), MENU_Y(40.0f), MENU_X_LEFT_ALIGNED(415.0f), MENU_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255)));
} }
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
@ -2457,19 +2393,19 @@ CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
CRect mouse(0.0f, 0.0f, MENU_X(75.0f), MENU_Y(75.0f)); CRect mouse(0.0f, 0.0f, MENU_X(40.0f), MENU_Y(40.0f));
CRect shad(MENU_X(10.0f), MENU_Y(3.0f), MENU_X(85.0f), MENU_Y(78.0f)); CRect shad(MENU_X(10.0f), MENU_Y(3.0f), MENU_X(55.0f), MENU_Y(43.0f));
mouse.Translate(m_nMousePosX, m_nMousePosY); mouse.Translate(m_nMousePosX, m_nMousePosY);
shad.Translate(m_nMousePosX, m_nMousePosY); shad.Translate(m_nMousePosX, m_nMousePosY);
if(field_518 == 4){ if(field_518 == 4){
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSET].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
}else{ }else{
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
m_aMenuSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255)); m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
} }
} }
} }
@ -2711,21 +2647,21 @@ CMenuManager::DrawPlayerSetupScreen()
// 2 - leaves gap between button and scrollbar // 2 - leaves gap between button and scrollbar
if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP) { if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP) {
#ifdef FIX_BUGS #ifdef FIX_BUGS
m_aMenuSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP), m_aFrontEndSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)), MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#else #else
m_aMenuSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP), m_aFrontEndSprites[MENUSPRITE_UPON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), MENU_Y(PLAYERSETUP_LIST_TOP),
MENU_X_RIGHT_ALIGNED(-20.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)), MENU_X_RIGHT_ALIGNED(-20.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#endif #endif
} else { } else {
#ifdef FIX_BUGS #ifdef FIX_BUGS
m_aMenuSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP), m_aFrontEndSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP),
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)), MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), MENU_Y(PLAYERSETUP_LIST_TOP + PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#else #else
m_aMenuSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP), m_aFrontEndSprites[MENUSPRITE_UPOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), MENU_Y(PLAYERSETUP_LIST_TOP),
MENU_X_RIGHT_ALIGNED(-21.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)), MENU_X_RIGHT_ALIGNED(-21.0f), MENU_Y(PLAYERSETUP_LIST_TOP + 58)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#endif #endif
@ -2733,21 +2669,21 @@ CMenuManager::DrawPlayerSetupScreen()
if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN) { if (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN) {
#ifdef FIX_BUGS #ifdef FIX_BUGS
m_aMenuSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1), m_aFrontEndSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1),
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)), MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#else #else
m_aMenuSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(141.0f), m_aFrontEndSprites[MENUSPRITE_DOWNON].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 2), SCREEN_SCALE_FROM_BOTTOM(141.0f),
MENU_X_RIGHT_ALIGNED(-20.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)), MENU_X_RIGHT_ALIGNED(-20.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#endif #endif
} else { } else {
#ifdef FIX_BUGS #ifdef FIX_BUGS
m_aMenuSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1), m_aFrontEndSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1),
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)), MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM + PLAYERSETUP_SCROLLBUTTON_HEIGHT + 1 - PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#else #else
m_aMenuSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(141.0f), m_aFrontEndSprites[MENUSPRITE_DOWNOFF].Draw(CRect(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT - 3), SCREEN_SCALE_FROM_BOTTOM(141.0f),
MENU_X_RIGHT_ALIGNED(-21.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)), MENU_X_RIGHT_ALIGNED(-21.0f), SCREEN_SCALE_FROM_BOTTOM(83.0f)),
CRGBA(255, 255, 255, FadeIn(255))); CRGBA(255, 255, 255, FadeIn(255)));
#endif #endif
@ -3021,51 +2957,59 @@ CMenuManager::LoadAllTextures()
CStreaming::ImGonnaUseStreamingMemory(); CStreaming::ImGonnaUseStreamingMemory();
CGame::TidyUpMemory(false, true); CGame::TidyUpMemory(false, true);
CTxdStore::PushCurrentTxd(); CTxdStore::PushCurrentTxd();
int frontendTxdSlot = CTxdStore::FindTxdSlot("frontend"); int frontendTxdSlot1 = CTxdStore::FindTxdSlot("frontend1");
if(frontendTxdSlot == -1) if(frontendTxdSlot1 == -1)
frontendTxdSlot = CTxdStore::AddTxdSlot("frontend"); frontendTxdSlot1 = CTxdStore::AddTxdSlot("frontend1");
printf("LOAD frontend\n"); printf("LOAD frontend1\n");
CTxdStore::LoadTxd(frontendTxdSlot, "MODELS/FRONTEND.TXD"); CTxdStore::LoadTxd(frontendTxdSlot1, "MODELS/FRONTEN1.TXD");
CTxdStore::AddRef(frontendTxdSlot); CTxdStore::AddRef(frontendTxdSlot1);
CTxdStore::SetCurrentTxd(frontendTxdSlot); CTxdStore::SetCurrentTxd(frontendTxdSlot1);
#ifndef GTA3_1_1_PATCH
CStreaming::IHaveUsedStreamingMemory();
CTimer::Update();
#endif
for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) { for (int i = 0; i < 3; i++) {
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]); m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]);
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
} }
int menuTxdSlot = CTxdStore::FindTxdSlot("menu"); CTxdStore::PopCurrentTxd();
CStreaming::IHaveUsedStreamingMemory();
if (menuTxdSlot == -1)
menuTxdSlot = CTxdStore::AddTxdSlot("menu");
printf("LOAD sprite\n"); // if ( !*(_BYTE *)(v1 + 124) )
CTxdStore::LoadTxd(menuTxdSlot, "MODELS/MENU.TXD");
CTxdStore::AddRef(menuTxdSlot);
CTxdStore::SetCurrentTxd(menuTxdSlot);
for (int i = 0; i < ARRAY_SIZE(MenuFilenames); i++) { CStreaming::MakeSpaceFor(350 * CDSTREAM_SECTOR_SIZE); // twice of it in mobile
m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]); CStreaming::ImGonnaUseStreamingMemory();
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); CTxdStore::PushCurrentTxd();
int frontendTxdSlot2 = CTxdStore::FindTxdSlot("frontend2");
if (frontendTxdSlot2 == -1)
frontendTxdSlot2 = CTxdStore::AddTxdSlot("frontend2");
printf("LOAD frontend2\n");
CTxdStore::LoadTxd(frontendTxdSlot2, "MODELS/FRONTEN2.TXD");
CTxdStore::AddRef(frontendTxdSlot2);
CTxdStore::SetCurrentTxd(frontendTxdSlot2);
for (int i = 3; i < NUM_MENU_SPRITES; i++) {
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]);
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
} }
#ifdef MENU_MAP
CTxdStore::PopCurrentTxd();
CStreaming::IHaveUsedStreamingMemory();
#if 0 //MENU_MAP
for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) { for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) {
m_aMapSprites[i].SetTexture(MapFilenames[i][0], MapFilenames[i][1]); m_aMapSprites[i].SetTexture(MapFilenames[i][0], MapFilenames[i][1]);
m_aMapSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); m_aMapSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
} }
#endif #endif
#ifdef GTA3_1_1_PATCH
CStreaming::IHaveUsedStreamingMemory();
CTimer::Update();
#endif
m_bSpritesLoaded = true; m_bSpritesLoaded = true;
CTxdStore::PopCurrentTxd(); CTimer::Update();
} }
void void
@ -5147,18 +5091,16 @@ CMenuManager::UnloadTextures()
for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); ++i) for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); ++i)
m_aFrontEndSprites[i].Delete(); m_aFrontEndSprites[i].Delete();
int frontend = CTxdStore::FindTxdSlot("frontend"); int frontend = CTxdStore::FindTxdSlot("frontend1");
CTxdStore::RemoveTxd(frontend); CTxdStore::RemoveTxd(frontend);
printf("REMOVE menu textures\n"); int frontend2 = CTxdStore::FindTxdSlot("frontend2");
for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i) CTxdStore::RemoveTxd(frontend2);
m_aMenuSprites[i].Delete();
#ifdef MENU_MAP #ifdef false //MENU_MAP
for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i) for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i)
m_aMapSprites[i].Delete(); m_aMapSprites[i].Delete();
#endif #endif
int menu = CTxdStore::FindTxdSlot("menu");
CTxdStore::RemoveTxd(menu);
m_bSpritesLoaded = false; m_bSpritesLoaded = false;
} }
@ -5468,47 +5410,47 @@ CMenuManager::PrintMap(void)
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - fMapSize) { if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
m_aMapSprites[MAPTOP1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - fMapSize, m_aFrontEndSprites[MENUSPRITE_MAPTOP01].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - fMapSize,
fMapCenterX - halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX - halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) { if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
m_aMapSprites[MAPTOP2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - fMapSize, m_aFrontEndSprites[MENUSPRITE_MAPTOP02].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - fMapSize,
fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) { if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
m_aMapSprites[MAPTOP3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize, m_aFrontEndSprites[MENUSPRITE_MAPTOP03].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize,
fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) { if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
m_aMapSprites[MAPMID1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - halfTile, m_aFrontEndSprites[MENUSPRITE_MAPMID01].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - halfTile,
fMapCenterX - halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX - halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
m_aMapSprites[MAPMID2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - halfTile, m_aFrontEndSprites[MENUSPRITE_MAPMID02].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - halfTile,
fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) { if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
m_aMapSprites[MAPMID3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile, m_aFrontEndSprites[MENUSPRITE_MAPMID03].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile,
fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY + halfTile) { if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile, m_aFrontEndSprites[MENUSPRITE_MAPBOT01].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile,
fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) { if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile, m_aFrontEndSprites[MENUSPRITE_MAPBOT02].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile,
fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
} }
if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) { if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile, m_aFrontEndSprites[MENUSPRITE_MAPBOT03].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile,
fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255))); fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
} }

View File

@ -131,26 +131,32 @@ enum eFrontendSprites
enum eMenuSprites enum eMenuSprites
{ {
MENUSPRITE_CONNECTION, MENUSPRITE_BACKGROUND,
MENUSPRITE_FINDGAME, MENUSPRITE_VCLOGO,
MENUSPRITE_HOSTGAME,
MENUSPRITE_MAINMENU,
MENUSPRITE_PLAYERSET,
MENUSPRITE_SINGLEPLAYER,
MENUSPRITE_MULTIPLAYER,
MENUSPRITE_DMALOGO,
MENUSPRITE_GTALOGO,
MENUSPRITE_RSTARLOGO,
MENUSPRITE_GAMESPY,
MENUSPRITE_MOUSE, MENUSPRITE_MOUSE,
MENUSPRITE_MOUSET, MENUSPRITE_MAPTOP01,
MENUSPRITE_MP3LOGO, MENUSPRITE_MAPTOP02,
MENUSPRITE_MAPTOP03,
MENUSPRITE_MAPMID01,
MENUSPRITE_MAPMID02,
MENUSPRITE_MAPMID03,
MENUSPRITE_MAPBOT01,
MENUSPRITE_MAPBOT02,
MENUSPRITE_MAPBOT03,
MENUSPRITE_WILDSTYLE,
MENUSPRITE_FLASH,
MENUSPRITE_KCHAT,
MENUSPRITE_FEVER,
MENUSPRITE_VROCK,
MENUSPRITE_VCPR,
MENUSPRITE_ESPANTOSO,
MENUSPRITE_EMOTION,
MENUSPRITE_WAVE,
MENUSPRITE_MP3,
MENUSPRITE_DOWNOFF, MENUSPRITE_DOWNOFF,
MENUSPRITE_DOWNON, MENUSPRITE_DOWNON,
MENUSPRITE_UPOFF, MENUSPRITE_UPOFF,
MENUSPRITE_UPON, MENUSPRITE_UPON,
MENUSPRITE_GTA3LOGO,
MENUSPRITE_UNUSED,
NUM_MENU_SPRITES NUM_MENU_SPRITES
}; };
@ -509,8 +515,9 @@ public:
char field_455; char field_455;
bool m_bStartWaitingForKeyBind; bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded; bool m_bSpritesLoaded;
CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES]; //CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
CSprite2d m_aMenuSprites[NUM_MENU_SPRITES]; //CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
CSprite2d m_aFrontEndSprites[NUM_MENU_SPRITES];
int32 field_518; int32 field_518;
int32 m_nMenuFadeAlpha; int32 m_nMenuFadeAlpha;
bool m_bPressedPgUpOnList; bool m_bPressedPgUpOnList;

View File

@ -84,6 +84,7 @@
#include "World.h" #include "World.h"
#include "ZoneCull.h" #include "ZoneCull.h"
#include "Zones.h" #include "Zones.h"
#include "Occlusion.h"
#include "debugmenu.h" #include "debugmenu.h"
@ -272,6 +273,7 @@ bool CGame::Initialise(const char* datFile)
ThePaths.AllocatePathFindInfoMem(4500); ThePaths.AllocatePathFindInfoMem(4500);
CWeather::Init(); CWeather::Init();
CCullZones::Init(); CCullZones::Init();
COcclusion::Init();
CCollision::Init(); CCollision::Init();
CTheZones::Init(); CTheZones::Init();
CUserDisplay::Init(); CUserDisplay::Init();

View File

@ -66,6 +66,8 @@ enum Config {
// Cull zones // Cull zones
NUMATTRIBZONES = 704, NUMATTRIBZONES = 704,
NUMOCCLUSIONVOLUMES = 350,
NUMHANDLINGS = 106, NUMHANDLINGS = 106,
PATHNODESIZE = 4500, PATHNODESIZE = 4500,

View File

@ -546,15 +546,20 @@ void CHud::Draw()
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f));
CFont::SetSlant(0.15f);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
CFont::SetSlant(0.f);
} }
} }
} }
@ -640,15 +645,20 @@ void CHud::Draw()
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f));
CFont::SetSlant(0.15f);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(105.f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f), m_pVehicleNameToPrint);
CFont::SetSlant(0.f);
} }
} }
} }

View File

@ -2,6 +2,42 @@
#include "Occlusion.h" #include "Occlusion.h"
int32 COcclusion::NumOccludersOnMap;
int16 COcclusion::FarAwayList;
int16 COcclusion::NearbyList;
int16 COcclusion::ListWalkThroughFA;
int16 COcclusion::PreviousListWalkThroughFA;
COccluder COcclusion::aOccluders[NUMOCCLUSIONVOLUMES];
void
COcclusion::Init(void)
{
NumOccludersOnMap = 0;
FarAwayList = -1;
NearbyList = -1;
ListWalkThroughFA = -1;
PreviousListWalkThroughFA = -1;
}
void
COcclusion::AddOne(float x, float y, float z, float width, float length, float height, float angle)
{
if(NumOccludersOnMap >= NUMOCCLUSIONVOLUMES)
return;
aOccluders[NumOccludersOnMap].x = x;
aOccluders[NumOccludersOnMap].y = y;
aOccluders[NumOccludersOnMap].z = z;
aOccluders[NumOccludersOnMap].width = width;
aOccluders[NumOccludersOnMap].length = length;
aOccluders[NumOccludersOnMap].height = height;
while(angle < 0.0f) angle += 360.0f;
while(angle > 360.0f) angle -= 360.0f;
aOccluders[NumOccludersOnMap].angle = angle * UINT16_MAX/360.0f;
aOccluders[NumOccludersOnMap].listIndex = FarAwayList;
FarAwayList = NumOccludersOnMap++;
}
void void
COcclusion::ProcessBeforeRendering(void) COcclusion::ProcessBeforeRendering(void)
{ {

View File

@ -1,7 +1,26 @@
#pragma once #pragma once
class COccluder
{
public:
int16 width, length, height;
int16 x, y, z;
uint16 angle;
int16 listIndex;
};
class COcclusion class COcclusion
{ {
public: public:
static int32 NumOccludersOnMap;
static int16 FarAwayList;
static int16 NearbyList;
static int16 ListWalkThroughFA;
static int16 PreviousListWalkThroughFA;
static COccluder aOccluders[NUMOCCLUSIONVOLUMES];
static void Init(void);
static void AddOne(float x, float y, float z, float width, float length, float height, float angle);
static void ProcessBeforeRendering(void); static void ProcessBeforeRendering(void);
}; };