mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-23 01:57:21 +03:00
Symbian^3 port
This commit is contained in:
parent
77cdaaf97e
commit
3eb71f2cc5
106 changed files with 2098 additions and 745 deletions
|
|
@ -29,11 +29,11 @@ void
|
|||
CColModel::RemoveCollisionVolumes(void)
|
||||
{
|
||||
if(ownsCollisionVolumes){
|
||||
RwFree(spheres);
|
||||
RwFree(lines);
|
||||
RwFree(boxes);
|
||||
RwFree(vertices);
|
||||
RwFree(triangles);
|
||||
if (spheres) RwFree(spheres);
|
||||
if (lines) RwFree(lines);
|
||||
if (boxes) RwFree(boxes);
|
||||
if (vertices) RwFree(vertices);
|
||||
if (triangles) RwFree(triangles);
|
||||
}
|
||||
numSpheres = 0;
|
||||
numLines = 0;
|
||||
|
|
@ -63,7 +63,7 @@ CColModel::CalculateTrianglePlanes(void)
|
|||
void
|
||||
CColModel::RemoveTrianglePlanes(void)
|
||||
{
|
||||
RwFree(trianglePlanes);
|
||||
if (trianglePlanes) RwFree(trianglePlanes);
|
||||
trianglePlanes = nil;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class CReplay
|
|||
uint8 hours;
|
||||
uint8 minutes;
|
||||
private:
|
||||
uint8 __align;
|
||||
uint8 __align1;
|
||||
};
|
||||
VALIDATE_SIZE(tClockPacket, 4);
|
||||
|
||||
|
|
@ -148,7 +148,9 @@ class CReplay
|
|||
uint16 mi;
|
||||
uint8 pedtype;
|
||||
private:
|
||||
uint8 __align[3];
|
||||
uint8 __align1;
|
||||
uint8 __align2;
|
||||
uint8 __align3;
|
||||
};
|
||||
VALIDATE_SIZE(tPedHeaderPacket, 8);
|
||||
|
||||
|
|
@ -167,7 +169,9 @@ class CReplay
|
|||
{
|
||||
uint8 type;
|
||||
private:
|
||||
uint8 __align[3];
|
||||
uint8 __align1;
|
||||
uint8 __align2;
|
||||
uint8 __align3;
|
||||
};
|
||||
VALIDATE_SIZE(tEndOfFramePacket, 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -3813,7 +3813,9 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
|||
Front.Normalise();
|
||||
Source = Source + Front*Speed;
|
||||
|
||||
Up = CVector{ 0.0f, 0.0f, 1.0f };
|
||||
Up.x = 0.0f;
|
||||
Up.y = 0.0f;
|
||||
Up.z = 1.0f;
|
||||
CVector Right = CrossProduct(Front, Up);
|
||||
Up = CrossProduct(Right, Front);
|
||||
Source = Source + Up*PanSpeedY + Right*PanSpeedX;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#ifndef __SYMBIAN32__
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -38,7 +40,8 @@ re3_sem_open(void)
|
|||
{
|
||||
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
|
||||
if (sem_init(sem, 0, 1) == -1) {
|
||||
sem = SEM_FAILED;
|
||||
free(sem);
|
||||
sem = (sem_t*)SEM_FAILED;
|
||||
}
|
||||
|
||||
return sem;
|
||||
|
|
@ -135,7 +138,7 @@ CdStreamInitThread(void)
|
|||
gCdStreamSema = RE3_SEM_OPEN("/semaphore_cd_stream");
|
||||
|
||||
|
||||
if (gCdStreamSema == SEM_FAILED) {
|
||||
if (gCdStreamSema == (sem_t*)SEM_FAILED) {
|
||||
CDTRACE("failed to create stream semaphore");
|
||||
ASSERT(0);
|
||||
return;
|
||||
|
|
@ -148,7 +151,7 @@ CdStreamInitThread(void)
|
|||
{
|
||||
gpReadInfo[i].pDoneSemaphore = RE3_SEM_OPEN("/semaphore_done%d", i);
|
||||
|
||||
if (gpReadInfo[i].pDoneSemaphore == SEM_FAILED)
|
||||
if (gpReadInfo[i].pDoneSemaphore == (sem_t*)SEM_FAILED)
|
||||
{
|
||||
CDTRACE("failed to create sync semaphore");
|
||||
ASSERT(0);
|
||||
|
|
@ -158,7 +161,7 @@ CdStreamInitThread(void)
|
|||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
gpReadInfo[i].pStartSemaphore = RE3_SEM_OPEN("/semaphore_start%d", i);
|
||||
|
||||
if (gpReadInfo[i].pStartSemaphore == SEM_FAILED)
|
||||
if (gpReadInfo[i].pStartSemaphore == (sem_t*)SEM_FAILED)
|
||||
{
|
||||
CDTRACE("failed to create start semaphore");
|
||||
ASSERT(0);
|
||||
|
|
@ -198,6 +201,7 @@ CdStreamInitThread(void)
|
|||
void
|
||||
CdStreamInit(int32 numChannels)
|
||||
{
|
||||
#if !defined __SYMBIAN32__
|
||||
struct statvfs fsInfo;
|
||||
|
||||
if((statvfs("models/gta3.img", &fsInfo)) < 0)
|
||||
|
|
@ -206,6 +210,7 @@ CdStreamInit(int32 numChannels)
|
|||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
_gdwCdStreamFlags = O_RDONLY | O_NOATIME;
|
||||
#else
|
||||
|
|
@ -219,8 +224,10 @@ CdStreamInit(int32 numChannels)
|
|||
debug("Using no buffered loading for streaming\n");
|
||||
}
|
||||
*/
|
||||
#if !defined __SYMBIAN32__
|
||||
void *pBuffer = (void *)RwMallocAlign(CDSTREAM_SECTOR_SIZE, (RwUInt32)fsInfo.f_bsize);
|
||||
ASSERT( pBuffer != nil );
|
||||
#endif
|
||||
|
||||
gNumImages = 0;
|
||||
|
||||
|
|
@ -234,8 +241,10 @@ CdStreamInit(int32 numChannels)
|
|||
|
||||
CdStreamInitThread();
|
||||
|
||||
#if !defined __SYMBIAN32__
|
||||
ASSERT( pBuffer != nil );
|
||||
RwFreeAlign(pBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32
|
||||
|
|
@ -531,6 +540,7 @@ void *CdStreamThread(void *param)
|
|||
free(gpReadInfo);
|
||||
gpReadInfo = nil;
|
||||
pthread_exit(nil);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ void CControllerConfigManager::MakeControllerActionsBlank()
|
|||
|
||||
#ifdef RW_GL3
|
||||
int MapIdToButtonId(int mapId) {
|
||||
#ifdef __SYMBIAN32__
|
||||
// TODO
|
||||
return mapId + 1;
|
||||
#else
|
||||
switch (mapId) {
|
||||
case GLFW_GAMEPAD_BUTTON_A: // Cross
|
||||
return 2;
|
||||
|
|
@ -82,6 +86,7 @@ int MapIdToButtonId(int mapId) {
|
|||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2771,8 +2776,10 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
|
|||
#elif defined RW_GL3
|
||||
if (m_NewState.isGamepad) {
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++) {
|
||||
#if !defined __SYMBIAN32__
|
||||
if (i == GLFW_GAMEPAD_BUTTON_GUIDE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
m_aButtonStates[MapIdToButtonId(i)-1] = m_NewState.mappedButtons[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1447,9 +1447,9 @@ CFileLoader::Load2dEffect(const char *line)
|
|||
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f",
|
||||
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
||||
&effect->particle.particleType,
|
||||
&effect->particle.dir.x,
|
||||
&effect->particle.dir.y,
|
||||
&effect->particle.dir.z,
|
||||
&effect->particle.dirX,
|
||||
&effect->particle.dirY,
|
||||
&effect->particle.dirZ,
|
||||
&effect->particle.scale);
|
||||
break;
|
||||
|
||||
|
|
@ -1457,9 +1457,9 @@ CFileLoader::Load2dEffect(const char *line)
|
|||
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %d",
|
||||
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
||||
&flags,
|
||||
&effect->attractor.dir.x,
|
||||
&effect->attractor.dir.y,
|
||||
&effect->attractor.dir.z,
|
||||
&effect->attractor.dirX,
|
||||
&effect->attractor.dirY,
|
||||
&effect->attractor.dirZ,
|
||||
&probability);
|
||||
effect->attractor.type = flags;
|
||||
#ifdef FIX_BUGS
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "Messages.h"
|
||||
#include "FileLoader.h"
|
||||
#include "frontendoption.h"
|
||||
#include "inifile.h"
|
||||
|
||||
// Game has colors inlined in code.
|
||||
// For easier modification we collect them here:
|
||||
|
|
@ -802,6 +803,8 @@ CMenuManager::CentreMousePointer()
|
|||
Point.y = SCREEN_HEIGHT / 2;
|
||||
ClientToScreen(PSGLOBAL(window), &Point);
|
||||
SetCursorPos(Point.x, Point.y);
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
#elif defined RW_GL3
|
||||
glfwSetCursorPos(PSGLOBAL(window), SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
|
||||
#endif
|
||||
|
|
@ -908,10 +911,10 @@ CMenuManager::CheckSliderMovement(int value)
|
|||
break;
|
||||
case MENUACTION_DRAWDIST:
|
||||
if(value > 0)
|
||||
m_PrefsLOD += ((1.8f - 0.8f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD += ((1.8f - 0.4f) / MENUSLIDER_LOGICAL_BARS);
|
||||
else
|
||||
m_PrefsLOD -= ((1.8f - 0.8f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD = Clamp(m_PrefsLOD, 0.8f, 1.8f);
|
||||
m_PrefsLOD -= ((1.8f - 0.4f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD = Clamp(m_PrefsLOD, 0.4f, 1.8f);
|
||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||
break;
|
||||
case MENUACTION_MUSICVOLUME:
|
||||
|
|
@ -1807,7 +1810,7 @@ CMenuManager::Draw()
|
|||
ProcessSlider(m_PrefsBrightness / 512.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
break;
|
||||
case MENUACTION_DRAWDIST:
|
||||
ProcessSlider((m_PrefsLOD - 0.8f) * 1.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
ProcessSlider((m_PrefsLOD - 0.4f) * 1.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
break;
|
||||
case MENUACTION_MUSICVOLUME:
|
||||
ProcessSlider(m_PrefsMusicVolume / 128.0f, HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
|
|
@ -3752,6 +3755,7 @@ CMenuManager::LoadSettings()
|
|||
#else
|
||||
CMBlur::BlurOn = true;
|
||||
#endif
|
||||
CMBlur::BlurOn = false;
|
||||
MousePointerStateHelper.bInvertVertically = true;
|
||||
|
||||
// 50 is silly
|
||||
|
|
@ -5099,9 +5103,11 @@ CMenuManager::ProcessButtonPresses(void)
|
|||
m_PrefsFrameLimiter = true;
|
||||
m_PrefsBrightness = 256;
|
||||
m_PrefsVsyncDisp = true;
|
||||
m_PrefsLOD = 1.2f;
|
||||
m_PrefsLOD = 0.7f;
|
||||
m_PrefsVsync = true;
|
||||
CRenderer::ms_lodDistScale = 1.2f;
|
||||
CRenderer::ms_lodDistScale = 0.7f;
|
||||
CIniFile::PedNumberMultiplier = 0.6f;
|
||||
CIniFile::CarNumberMultiplier = 0.6f;
|
||||
#ifdef ASPECT_RATIO_SCALE
|
||||
m_PrefsUseWideScreen = AR_AUTO;
|
||||
#else
|
||||
|
|
@ -5139,6 +5145,8 @@ CMenuManager::ProcessButtonPresses(void)
|
|||
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
|
||||
}
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
#else
|
||||
if (PSGLOBAL(joy1id) != -1 && glfwJoystickPresent(PSGLOBAL(joy1id))) {
|
||||
int count;
|
||||
|
|
@ -5649,7 +5657,7 @@ void
|
|||
CMenuManager::ShutdownJustMenu()
|
||||
{
|
||||
// In case we're windowed, keep mouse centered while in game. Done in main.cpp in other conditions.
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE)
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE) && !defined(__SYMBIAN32__)
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
#endif
|
||||
m_bMenuActive = false;
|
||||
|
|
@ -5758,7 +5766,7 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||
m_bMenuStateChanged = true;
|
||||
|
||||
// In case we're windowed, keep mouse centered while in game. Done in main.cpp in other conditions.
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE)
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE) && !defined(__SYMBIAN32__)
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, m_bMenuActive && m_nPrefsWindowed ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_DISABLED);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,6 +667,13 @@ public:
|
|||
static int8 m_nPrefsMSAALevel;
|
||||
static int8 m_nDisplayMSAALevel;
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#undef LANGUAGE_FRENCH
|
||||
#undef LANGUAGE_GERMAN
|
||||
#undef LANGUAGE_ITALIAN
|
||||
#undef LANGUAGE_SPANISH
|
||||
#endif
|
||||
|
||||
enum LANGUAGE
|
||||
{
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ CGame::InitialiseRenderWare(void)
|
|||
return (false);
|
||||
}
|
||||
|
||||
RwCameraSetFarClipPlane(Scene.camera, 2000.0f); // 250.0f on PS2 but who cares
|
||||
RwCameraSetFarClipPlane(Scene.camera, 250.0f); // 250.0f on PS2 but who cares
|
||||
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
|
||||
|
||||
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
#include "main.h"
|
||||
#include "Population.h"
|
||||
|
||||
float CIniFile::PedNumberMultiplier = 1.0f;
|
||||
float CIniFile::CarNumberMultiplier = 1.0f;
|
||||
float CIniFile::PedNumberMultiplier = 0.6f;
|
||||
float CIniFile::CarNumberMultiplier = 0.6f;
|
||||
|
||||
void CIniFile::LoadIniFile()
|
||||
{
|
||||
CFileMgr::SetDir("");
|
||||
#if 0
|
||||
int f = CFileMgr::OpenFile("gta3.ini", "r");
|
||||
if (f){
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
|
|
@ -23,6 +24,7 @@ void CIniFile::LoadIniFile()
|
|||
CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
|
||||
CFileMgr::CloseFile(f);
|
||||
}
|
||||
#endif
|
||||
CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS * PedNumberMultiplier;
|
||||
CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS * CarNumberMultiplier;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,12 +158,14 @@ void RestoreDefDisplay(int8 action) {
|
|||
TheCamera.bFreeCam = false;
|
||||
#endif
|
||||
#ifdef PED_CAR_DENSITY_SLIDERS
|
||||
CIniFile::PedNumberMultiplier = 0.6f;
|
||||
CIniFile::CarNumberMultiplier = 0.6f;
|
||||
CIniFile::LoadIniFile();
|
||||
#endif
|
||||
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
|
||||
CMenuManager::m_PrefsBrightness = 256;
|
||||
CMenuManager::m_PrefsLOD = 1.2f;
|
||||
CRenderer::ms_lodDistScale = 1.2f;
|
||||
CMenuManager::m_PrefsLOD = 0.7f;
|
||||
CRenderer::ms_lodDistScale = 0.7f;
|
||||
CMenuManager::m_PrefsShowSubtitles = true;
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
#endif
|
||||
|
|
@ -395,6 +397,10 @@ void ControllerTypeAfterChange(int8 before, int8 after)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
CCustomScreenLayout graphicsSettingsLayout = {MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE};
|
||||
#endif
|
||||
|
||||
CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
// MENUPAGE_NONE = 0
|
||||
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil, },
|
||||
|
|
@ -891,7 +897,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
// MENUPAGE_GRAPHICS_SETTINGS
|
||||
{ "FET_GFX", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
|
||||
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack,
|
||||
new CCustomScreenLayout(graphicsSettingsLayout), GraphicsGoBack,
|
||||
|
||||
#ifndef GTA_HANDHELD
|
||||
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
|
||||
|
|
|
|||
|
|
@ -526,11 +526,16 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
state.WHEELUP = true;
|
||||
}
|
||||
}
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
state.LMB = true;
|
||||
#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;
|
||||
#ifndef __SYMBIAN32__
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
|
||||
#endif
|
||||
|
||||
if (xpos != 0.f) {
|
||||
state.MMB = true;
|
||||
state.RMB = true;
|
||||
|
|
@ -585,11 +590,17 @@ void CPad::UpdateMouse()
|
|||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if defined __SYMBIAN32__
|
||||
if ( IsForegroundApp() /*&& PSGLOBAL(cursorIsInWindow)*/ )
|
||||
#else
|
||||
if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
|
||||
#endif
|
||||
{
|
||||
double xpos = 1.0f, ypos;
|
||||
#ifndef __SYMBIAN32__
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
#endif
|
||||
if (xpos == 0.f)
|
||||
return;
|
||||
|
||||
|
|
@ -608,12 +619,14 @@ void CPad::UpdateMouse()
|
|||
|
||||
PCTempMouseControllerState.x = (float)(signX * (xpos - PSGLOBAL(lastMousePos.x)));
|
||||
PCTempMouseControllerState.y = (float)(signy * (ypos - PSGLOBAL(lastMousePos.y)));
|
||||
#ifndef __SYMBIAN32__
|
||||
PCTempMouseControllerState.LMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_LEFT);
|
||||
PCTempMouseControllerState.RMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_RIGHT);
|
||||
PCTempMouseControllerState.MMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_MIDDLE);
|
||||
PCTempMouseControllerState.MXB1 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_4);
|
||||
PCTempMouseControllerState.MXB2 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_5);
|
||||
|
||||
#endif
|
||||
|
||||
if (PSGLOBAL(mouseWheel) > 0)
|
||||
PCTempMouseControllerState.WHEELUP = 1;
|
||||
else if (PSGLOBAL(mouseWheel) < 0)
|
||||
|
|
|
|||
|
|
@ -412,6 +412,8 @@ FindPlayerCoors(void)
|
|||
return TheCamera.GetPosition();
|
||||
#endif
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if (!ped)
|
||||
return TheCamera.GetPosition();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle->GetPosition();
|
||||
else
|
||||
|
|
@ -659,4 +661,4 @@ CPlayerInfo::DeletePlayerSkin()
|
|||
m_pSkinTexture = nil;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ int32 islandLODcomSub;
|
|||
int32 islandLODsubInd;
|
||||
int32 islandLODsubCom;
|
||||
|
||||
#define STREAMING_MEM_SIZE (10 * 1024 * 1024)
|
||||
|
||||
bool
|
||||
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
|
||||
{
|
||||
|
|
@ -219,11 +221,13 @@ CStreaming::Init2(void)
|
|||
#ifdef GTA_PC
|
||||
#define MB (1024*1024)
|
||||
|
||||
extern size_t _dwMemAvailPhys;
|
||||
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
||||
if(ms_memoryAvailable < 50*MB)
|
||||
ms_memoryAvailable = 50*MB;
|
||||
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
||||
// extern size_t _dwMemAvailPhys;
|
||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
||||
// if(ms_memoryAvailable < 50*MB)
|
||||
// ms_memoryAvailable = 50*MB;
|
||||
// desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||
desiredNumVehiclesLoaded = 12;
|
||||
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
||||
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
|
||||
debug("Memory allocated to Streaming is %zuMB", ms_memoryAvailable/MB); // original modifier was %d
|
||||
|
|
@ -2687,9 +2691,10 @@ CStreaming::MakeSpaceFor(int32 size)
|
|||
#ifdef FIX_BUGS
|
||||
#define MB (1024 * 1024)
|
||||
if(ms_memoryAvailable == 0) {
|
||||
extern size_t _dwMemAvailPhys;
|
||||
ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||
if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
||||
// extern size_t _dwMemAvailPhys;
|
||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||
// if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||
}
|
||||
#undef MB
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ void CTimer::Resume(void)
|
|||
oldPcTimer += RsTimer() - suspendPcTimer;
|
||||
}
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
uint32 CTimer::GetCyclesPerMillisecond(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -287,6 +288,7 @@ uint32 CTimer::GetCyclesPerMillisecond(void)
|
|||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32 CTimer::GetCurrentTimeInCycles(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#define CTimer CTimer2
|
||||
class CTimer2
|
||||
#else
|
||||
class CTimer
|
||||
#endif
|
||||
{
|
||||
|
||||
static uint32 m_snTimeInMilliseconds;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@
|
|||
#include "Debug.h"
|
||||
#include "Renderer.h"
|
||||
|
||||
#if defined __ARMCC_VERSION && !defined _DEBUG
|
||||
#pragma O2
|
||||
#endif
|
||||
|
||||
int32 CCullZones::NumCullZones;
|
||||
CCullZone CCullZones::aZones[NUMCULLZONES];
|
||||
int32 CCullZones::NumAttributeZones;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#pragma warning(disable: 4838) // narrowing conversion
|
||||
#pragma warning(disable: 4996) // POSIX names
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#if defined __MWERKS__ || defined __SYMBIAN32__
|
||||
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
|
||||
#endif
|
||||
|
||||
|
|
@ -363,6 +363,10 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#undef ASSERT
|
||||
#endif
|
||||
|
||||
#ifndef MASTER
|
||||
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
||||
#else
|
||||
|
|
@ -370,7 +374,7 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
|||
#endif
|
||||
#define ASSERT assert
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#if defined __MWERKS__ || defined __SYMBIAN32__
|
||||
#define static_assert(bool_constexpr, message)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ enum Config {
|
|||
EXTRADIRSIZE = 128,
|
||||
CUTSCENEDIRSIZE = 512,
|
||||
|
||||
SIMPLEMODELSIZE = 5000, // 2910 on PS2
|
||||
SIMPLEMODELSIZE = 2916, // 2910 on PS2
|
||||
MLOMODELSIZE = 1,
|
||||
MLOINSTANCESIZE = 1,
|
||||
TIMEMODELSIZE = 30,
|
||||
|
|
@ -31,15 +31,15 @@ enum Config {
|
|||
XTRACOMPSMODELSIZE = 2,
|
||||
TWODFXSIZE = 2000, // 1210 on PS2
|
||||
|
||||
MAXVEHICLESLOADED = 50, // 70 on mobile
|
||||
MAXVEHICLESLOADED = 35, // 70 on mobile
|
||||
|
||||
NUMOBJECTINFO = 168, // object.dat
|
||||
|
||||
// Pool sizes
|
||||
NUMPTRNODES = 30000, // 26000 on PS2
|
||||
NUMENTRYINFOS = 5400, // 3200 on PS2
|
||||
NUMPEDS = 140, // 90 on PS2
|
||||
NUMVEHICLES = 110, // 70 on PS2
|
||||
NUMPEDS = 110, // 90 on PS2
|
||||
NUMVEHICLES = 90, // 70 on PS2
|
||||
NUMBUILDINGS = 5500, // 4915 on PS2
|
||||
NUMTREADABLES = 1214,
|
||||
NUMOBJECTS = 450,
|
||||
|
|
@ -157,7 +157,7 @@ enum Config {
|
|||
#define GTA_VERSION GTA3_PC_11
|
||||
|
||||
// Enable configuration for handheld console ports
|
||||
#if defined(__SWITCH__) || defined(PSP2)
|
||||
#if defined(__SWITCH__) || defined(PSP2) || defined(__SYMBIAN32__)
|
||||
#define GTA_HANDHELD
|
||||
#endif
|
||||
|
||||
|
|
@ -170,11 +170,11 @@ enum Config {
|
|||
# define PS2_MENU
|
||||
#elif defined GTA_PC
|
||||
# define EXTERNAL_3D_SOUND
|
||||
# define AUDIO_REFLECTIONS
|
||||
//# define AUDIO_REFLECTIONS
|
||||
# ifndef GTA_HANDHELD
|
||||
# define PC_PLAYER_CONTROLS // mouse player/cam mode
|
||||
# endif
|
||||
# define GTA_REPLAY
|
||||
//# define GTA_REPLAY
|
||||
# define GTA_SCENE_EDIT
|
||||
# define PC_MENU
|
||||
#elif defined GTA_XBOX
|
||||
|
|
@ -238,7 +238,7 @@ enum Config {
|
|||
#if defined GTA_PC && defined GTA_PS2_STUFF
|
||||
# define USE_PS2_RAND
|
||||
# define RANDOMSPLASH // use random splash as on PS2
|
||||
# define PS2_MATFX
|
||||
//# define PS2_MATFX
|
||||
#endif
|
||||
|
||||
#ifdef VU_COLLISION
|
||||
|
|
@ -263,12 +263,13 @@ enum Config {
|
|||
# define CHATTYSPLASH // print what the game is loading
|
||||
# define TIMEBARS // print debug timers
|
||||
#endif
|
||||
#define TIMEBARS
|
||||
|
||||
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
|
||||
#define MORE_LANGUAGES // Add more translations to the game
|
||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
|
||||
//#define MORE_LANGUAGES // Add more translations to the game
|
||||
//#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
|
||||
#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
|
||||
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||
//#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||
|
||||
#define NO_MOVIES // add option to disable intro videos
|
||||
|
||||
|
|
@ -291,28 +292,28 @@ enum Config {
|
|||
#endif
|
||||
|
||||
// Rendering/display
|
||||
//#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
|
||||
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
||||
#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
|
||||
# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
||||
// NB: keep this enabled unless your map IDEs have these flags baked in
|
||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
|
||||
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
||||
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
||||
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
||||
//#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
||||
#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
|
||||
#ifdef DISABLE_LOADING_SCREEN
|
||||
// enable the PC splash
|
||||
#undef RANDOMSPLASH
|
||||
#endif
|
||||
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
||||
#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
|
||||
//#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
|
||||
//#define USE_TEXTURE_POOL
|
||||
#ifdef LIBRW
|
||||
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
#define SCREEN_DROPLETS // neo water droplets
|
||||
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
//#define SCREEN_DROPLETS // neo water droplets
|
||||
//#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||
#endif
|
||||
|
||||
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
|
||||
|
|
@ -382,7 +383,7 @@ enum Config {
|
|||
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
|
||||
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
|
||||
#ifdef PC_MENU
|
||||
# define MISSION_REPLAY // mobile feature
|
||||
//# define MISSION_REPLAY // mobile feature
|
||||
#endif
|
||||
//#define SIMPLIER_MISSIONS // apply simplifications from mobile
|
||||
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
|
|
@ -427,19 +428,19 @@ enum Config {
|
|||
#define FREE_CAM // Rotating cam
|
||||
|
||||
// Audio
|
||||
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
||||
//#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
||||
// originally and making it work in 2d only requires more resource). Will not work on PS2
|
||||
#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2.
|
||||
//#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2.
|
||||
#define RADIO_SCROLL_TO_PREV_STATION
|
||||
#define AUDIO_CACHE
|
||||
//#define AUDIO_CACHE
|
||||
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally)
|
||||
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
|
||||
#define ATTACH_RELEASING_SOUNDS_TO_ENTITIES // sounds would follow ped and vehicles coordinates if not being queued otherwise
|
||||
#define USE_TIME_SCALE_FOR_AUDIO // slow down/speed up sounds according to the speed of the game
|
||||
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||
//#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||
|
||||
#ifdef AUDIO_OPUS
|
||||
#define AUDIO_OAL_USE_OPUS // enable support of opus files
|
||||
|
|
@ -454,13 +455,13 @@ enum Config {
|
|||
#endif
|
||||
|
||||
// Streaming
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__) && !defined __SYMBIAN32__
|
||||
//#define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash - also not utilized too much right now(see commented LoadAllRequestedModels in Streaming.cpp)
|
||||
#define FLUSHABLE_STREAMING // Make it possible to interrupt reading when processing file isn't needed anymore.
|
||||
#endif
|
||||
#define BIG_IMG // Not complete - allows to read larger img files
|
||||
|
||||
//#define SQUEEZE_PERFORMANCE
|
||||
#define SQUEEZE_PERFORMANCE
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
#undef PS2_ALPHA_TEST
|
||||
#undef NO_ISLAND_LOADING
|
||||
|
|
@ -481,7 +482,7 @@ enum Config {
|
|||
#define IGNORE_MOUSE_KEYBOARD // ignore mouse & keyboard input
|
||||
#endif
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#if defined __SWITCH__ || defined __SYMBIAN32__
|
||||
#define USE_UNNAMED_SEM // named semaphores are unsupported on the switch
|
||||
#endif
|
||||
|
||||
|
|
@ -495,4 +496,4 @@ enum Config {
|
|||
#endif
|
||||
#if defined(AUDIO_REFLECTIONS) && GTA_VERSION < GTA3_PC_10
|
||||
#error AUDIO_REFLECTIONS cannot work with versions below GTA3_PC_10
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ float FramesPerSecond = 30.0f;
|
|||
bool gbPrintShite = false;
|
||||
bool gbModelViewer;
|
||||
#ifdef TIMEBARS
|
||||
bool gbShowTimebars;
|
||||
bool gbShowTimebars = true;
|
||||
#endif
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
bool gbDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds
|
||||
|
|
@ -1401,10 +1401,10 @@ RenderScene(void)
|
|||
}
|
||||
#endif
|
||||
PUSH_RENDERGROUP("RenderScene");
|
||||
CClouds::Render();
|
||||
// CClouds::Render();
|
||||
DoRWRenderHorizon();
|
||||
CRenderer::RenderRoads();
|
||||
CCoronas::RenderReflections();
|
||||
// CCoronas::RenderReflections();
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||
CRenderer::RenderEverythingBarRoads();
|
||||
CRenderer::RenderBoats();
|
||||
|
|
@ -1414,7 +1414,7 @@ RenderScene(void)
|
|||
#ifndef SQUEEZE_PERFORMANCE
|
||||
CRenderer::RenderVehiclesButNotBoats();
|
||||
#endif
|
||||
CWeather::RenderRainStreaks();
|
||||
// CWeather::RenderRainStreaks();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
|
|
@ -1446,17 +1446,17 @@ RenderEffects(void)
|
|||
CGlass::Render();
|
||||
CWaterCannons::Render();
|
||||
CSpecialFX::Render();
|
||||
CShadows::RenderStaticShadows();
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CAntennas::Render();
|
||||
CRubbish::Render();
|
||||
CCoronas::Render();
|
||||
CParticle::Render();
|
||||
// CShadows::RenderStaticShadows();
|
||||
// CShadows::RenderStoredShadows();
|
||||
// CSkidmarks::Render();
|
||||
// CAntennas::Render();
|
||||
// CRubbish::Render();
|
||||
// CCoronas::Render();
|
||||
// CParticle::Render();
|
||||
CPacManPickups::Render();
|
||||
CWeaponEffects::Render();
|
||||
CPointLights::RenderFogEffect();
|
||||
CMovingThings::Render();
|
||||
// CWeaponEffects::Render();
|
||||
// CPointLights::RenderFogEffect();
|
||||
// CMovingThings::Render();
|
||||
CRenderer::RenderFirstPersonVehicle();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1160,7 +1160,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
|||
abort();
|
||||
#else
|
||||
// TODO
|
||||
printf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
re3_debug("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "common.h"
|
||||
#ifndef MASTER
|
||||
#ifdef TIMEBARS
|
||||
#include "Font.h"
|
||||
#include "Frontend.h"
|
||||
#include "Timer.h"
|
||||
|
|
@ -96,7 +96,10 @@ void tbDisplay()
|
|||
sprintf(temp, "FPS: %.2f", Diag_GetFPS());
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
CFont::SetColor(CRGBA(255, 255, 255, 255));
|
||||
if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials) {
|
||||
#ifndef MASTER
|
||||
if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials)
|
||||
#endif
|
||||
{
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * (4.0f / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
|
||||
#ifndef FINAL
|
||||
|
|
@ -105,7 +108,7 @@ void tbDisplay()
|
|||
MaxTimes[i] = Max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
|
||||
sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / 200), wtemp);
|
||||
}
|
||||
|
||||
#ifdef FRAMETIME
|
||||
|
|
@ -113,9 +116,9 @@ void tbDisplay()
|
|||
sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / 200), wtemp);
|
||||
#endif // FRAMETIME
|
||||
#endif // !FINAL
|
||||
}
|
||||
}
|
||||
#endif // !MASTER
|
||||
#endif // !MASTER
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#pragma once
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
class CMatrix
|
||||
{
|
||||
|
|
@ -128,4 +131,4 @@ public:
|
|||
class CCompressedMatrix : public CCompressedMatrixNotAligned
|
||||
{
|
||||
int _alignment; // no clue what would this align to
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7215,7 +7215,11 @@ CPed::LookForInterestingNodes(void)
|
|||
if (!found)
|
||||
return false;
|
||||
|
||||
CVector effectFrontLocal = Multiply3x3(*objMat, effect->attractor.dir);
|
||||
CVector dir;
|
||||
dir.x = effect->attractor.dirX;
|
||||
dir.y = effect->attractor.dirY;
|
||||
dir.z = effect->attractor.dirZ;
|
||||
CVector effectFrontLocal = Multiply3x3(*objMat, dir);
|
||||
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f);
|
||||
randVal = CGeneral::GetRandomNumber() % 256;
|
||||
if (randVal <= m_randomSeed % 256) {
|
||||
|
|
|
|||
|
|
@ -3694,7 +3694,9 @@ CPed::SetExitBoat(CVehicle *boat)
|
|||
RemoveInCarAnims();
|
||||
CColModel* boatCol = boat->GetColModel();
|
||||
if (boat->IsUpsideDown()) {
|
||||
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z };
|
||||
newPos.x = 0.0f;
|
||||
newPos.y = 0.0f;
|
||||
newPos.z = boatCol->boundingBox.min.z;
|
||||
newPos = boat->GetMatrix() * newPos;
|
||||
newPos.z += 1.0f;
|
||||
m_vehDoor = CAR_DOOR_RF;
|
||||
|
|
@ -5401,4 +5403,4 @@ CPed::WarpPedToNearEntityOffScreen(CEntity *warpTo)
|
|||
}
|
||||
m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 3000;
|
||||
return teleported;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#pragma once
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
enum {
|
||||
EFFECT_LIGHT,
|
||||
|
|
@ -55,11 +58,13 @@ public:
|
|||
};
|
||||
struct Particle {
|
||||
int particleType;
|
||||
CVector dir;
|
||||
// CVector dir;
|
||||
float dirX, dirY, dirZ;
|
||||
float scale;
|
||||
};
|
||||
struct Attractor {
|
||||
CVector dir;
|
||||
// CVector dir;
|
||||
float dirX, dirY, dirZ;
|
||||
int8 type;
|
||||
uint8 probability;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -470,9 +470,9 @@ CFont::Shutdown(void)
|
|||
void
|
||||
CFont::InitPerFrame(void)
|
||||
{
|
||||
Details.bank = CSprite2d::GetBank(30, Sprite[0].m_pTexture);
|
||||
CSprite2d::GetBank(15, Sprite[1].m_pTexture);
|
||||
CSprite2d::GetBank(15, Sprite[2].m_pTexture);
|
||||
Details.bank = CSprite2d::GetBank(300, Sprite[0].m_pTexture);
|
||||
CSprite2d::GetBank(100, Sprite[1].m_pTexture);
|
||||
CSprite2d::GetBank(100, Sprite[2].m_pTexture);
|
||||
#ifdef MORE_LANGUAGES
|
||||
if (IsJapanese())
|
||||
CSprite2d::GetBank(15, Sprite[3].m_pTexture);
|
||||
|
|
@ -1625,4 +1625,4 @@ CFont::character_code(uint8 c)
|
|||
if(c < 128)
|
||||
return c;
|
||||
return foreign_table[c-128];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
|
|||
debug("Available video memory %d\n", avaible);
|
||||
#endif
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
if(BlurOn)
|
||||
{
|
||||
uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
|
||||
|
|
@ -123,6 +124,7 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
|
|||
#endif
|
||||
CreateImmediateModeData(cam, &rect);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
|
||||
|
|
@ -215,6 +217,8 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
|
|||
if( pFrontBuffer )
|
||||
OverlayRender(cam, pFrontBuffer, color, type, bluralpha);
|
||||
#else
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
if(BlurOn){
|
||||
if(pFrontBuffer){
|
||||
if(ms_bJustInitialised)
|
||||
|
|
@ -228,6 +232,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
|
|||
}else{
|
||||
OverlayRender(cam, nil, color, type, bluralpha);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
POP_RENDERGROUP();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -601,22 +601,27 @@ CEntity::AddSteamsFromGround(CVector *unused)
|
|||
if(effect->type != EFFECT_PARTICLE)
|
||||
continue;
|
||||
|
||||
CVector dir;
|
||||
dir.x = effect->particle.dirX;
|
||||
dir.y = effect->particle.dirY;
|
||||
dir.z = effect->particle.dirZ;
|
||||
|
||||
pos = GetMatrix() * effect->pos;
|
||||
switch(effect->particle.particleType){
|
||||
case 0:
|
||||
CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 1:
|
||||
CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 2:
|
||||
CParticleObject::AddObject(POBJECT_DRY_ICE, pos, effect->particle.scale, false);
|
||||
break;
|
||||
case 3:
|
||||
CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 4:
|
||||
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ CLinkList<EntityInfo> gSortedBuildings;
|
|||
CVector CRenderer::ms_vecCameraPosition;
|
||||
CVehicle *CRenderer::m_pFirstPersonVehicle;
|
||||
bool CRenderer::m_loadingPriority;
|
||||
float CRenderer::ms_lodDistScale = 1.2f;
|
||||
float CRenderer::ms_lodDistScale = 0.7f;
|
||||
|
||||
// unused
|
||||
BlockedRange CRenderer::aBlockedRanges[16];
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class CVehicle;
|
|||
enum {
|
||||
// NB: not all values are allowed, check the code
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
NUM_RUBBISH_SHEETS = 32
|
||||
NUM_RUBBISH_SHEETS = 16
|
||||
#else
|
||||
NUM_RUBBISH_SHEETS = 64
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#define MAX_STOREDSHADOWS 48
|
||||
#define MAX_STOREDSHADOWS 12
|
||||
#define MAX_POLYBUNCHES 300
|
||||
#define MAX_STATICSHADOWS 64
|
||||
#define MAX_PERMAMENTSHADOWS 48
|
||||
#define MAX_STATICSHADOWS 16
|
||||
#define MAX_PERMAMENTSHADOWS 12
|
||||
|
||||
|
||||
class CEntity;
|
||||
|
|
|
|||
|
|
@ -137,10 +137,10 @@ void
|
|||
CSpecialFX::Render(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("CSpecialFX::Render");
|
||||
CMotionBlurStreaks::Render();
|
||||
CBulletTraces::Render();
|
||||
CBrightLights::Render();
|
||||
CShinyTexts::Render();
|
||||
// CMotionBlurStreaks::Render();
|
||||
// CBulletTraces::Render();
|
||||
// CBrightLights::Render();
|
||||
// CShinyTexts::Render();
|
||||
CMoneyMessages::Render();
|
||||
#ifdef NEW_RENDERER
|
||||
if(!(gbNewRenderer && FredIsInFirstPersonCam()))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ int32 CSprite2d::mCurrentBank;
|
|||
RwTexture *CSprite2d::mpBankTextures[10];
|
||||
int32 CSprite2d::mCurrentSprite[10];
|
||||
int32 CSprite2d::mBankStart[10];
|
||||
RwIm2DVertex CSprite2d::maBankVertices[500];
|
||||
RwIm2DVertex CSprite2d::maBankVertices[3000];
|
||||
|
||||
void
|
||||
CSprite2d::SetRecipNearClip(void)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class CSprite2d
|
|||
static RwTexture *mpBankTextures[10];
|
||||
static int32 mCurrentSprite[10];
|
||||
static int32 mBankStart[10];
|
||||
static RwIm2DVertex maBankVertices[500];
|
||||
static RwIm2DVertex maBankVertices[3000];
|
||||
static RwIm2DVertex maVertices[8];
|
||||
public:
|
||||
RwTexture *m_pTexture;
|
||||
|
|
|
|||
|
|
@ -588,23 +588,24 @@ inline float
|
|||
_GetWaterDrawDist()
|
||||
{
|
||||
// if z less then 15.0f return 1200.0f
|
||||
if ( TheCamera.GetPosition().z < 15.0f )
|
||||
return 1200.0f;
|
||||
// if ( TheCamera.GetPosition().z < 15.0f )
|
||||
// return 1200.0f;
|
||||
|
||||
// if z greater then 60.0f return 2000.0f;
|
||||
if ( TheCamera.GetPosition().z > 60.0f )
|
||||
return 2000.0f;
|
||||
|
||||
return (TheCamera.GetPosition().z + -15.0f) * 800.0f / 45.0f + 1200.0f;
|
||||
return 700.0f;
|
||||
|
||||
return 4500.0f;
|
||||
// return (TheCamera.GetPosition().z + -15.0f) * 800.0f / 45.0f + 1200.0f;
|
||||
}
|
||||
|
||||
inline float
|
||||
_GetWavyDrawDist()
|
||||
{
|
||||
if ( FindPlayerVehicle() && FindPlayerVehicle()->IsBoat() )
|
||||
return 120.0f;
|
||||
return 80.0f;
|
||||
else
|
||||
return 70.0f;
|
||||
return 45.0f;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
};
|
||||
|
||||
enum {
|
||||
NUM_RAIN_STREAKS = 35
|
||||
NUM_RAIN_STREAKS = 10
|
||||
};
|
||||
|
||||
struct tRainStreak
|
||||
|
|
@ -68,4 +68,4 @@ struct tRainStreak
|
|||
uint32 timer;
|
||||
};
|
||||
|
||||
extern RwTexture* gpRainDropTex[4];
|
||||
extern RwTexture* gpRainDropTex[4];
|
||||
|
|
|
|||
|
|
@ -28,6 +28,99 @@
|
|||
float texLoadTime;
|
||||
int32 texNumLoaded;
|
||||
|
||||
static RwImage* resizeImage(RwImage *image, int newWidth, int newHeight)
|
||||
{
|
||||
image->convertTo32();
|
||||
|
||||
RwImage *resized = RwImageCreate(newWidth, newHeight, 32);
|
||||
if (resized == nil) return nil;
|
||||
|
||||
RwImageAllocatePixels(resized);
|
||||
if (resized->pixels == nil) {
|
||||
RwImageDestroy(resized);
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (int y = 0; y < newHeight; y++) {
|
||||
uint8 *dst = resized->pixels + y*resized->stride;
|
||||
int y0 = y*image->height/newHeight;
|
||||
int y1 = (y + 1)*image->height/newHeight;
|
||||
if (y1 <= y0)
|
||||
y1 = y0 + 1;
|
||||
|
||||
for (int x = 0; x < newWidth; x++) {
|
||||
int x0 = x*image->width/newWidth;
|
||||
int x1 = (x + 1)*image->width/newWidth;
|
||||
if (x1 <= x0)
|
||||
x1 = x0 + 1;
|
||||
|
||||
uint r = 0;
|
||||
uint g = 0;
|
||||
uint b = 0;
|
||||
uint a = 0;
|
||||
uint samples = 0;
|
||||
|
||||
for (int sy = y0; sy < y1; sy++) {
|
||||
const uint8 *src = image->pixels + sy*image->stride + x0*4;
|
||||
for (int sx = x0; sx < x1; sx++) {
|
||||
r += src[0];
|
||||
g += src[1];
|
||||
b += src[2];
|
||||
a += src[3];
|
||||
samples++;
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
|
||||
dst[0] = r / samples;
|
||||
dst[1] = g / samples;
|
||||
dst[2] = b / samples;
|
||||
dst[3] = a / samples;
|
||||
dst += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
static int clamp(int32 size)
|
||||
{
|
||||
while (size > 32 && size > 1) {
|
||||
size = (size + 1) / 2;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
static void downscaleTexture(RwTexture *texture)
|
||||
{
|
||||
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||
if (oldRaster == nil)
|
||||
return;
|
||||
|
||||
int oldWidth = RwRasterGetWidth(oldRaster);
|
||||
int oldHeight = RwRasterGetHeight(oldRaster);
|
||||
if (oldWidth <= 32 && oldHeight <= 32) return;
|
||||
|
||||
int newWidth = clamp(oldWidth);
|
||||
int newHeight = clamp(oldHeight);
|
||||
if (newWidth == oldWidth && newHeight == oldHeight) return;
|
||||
|
||||
RwImage *image = oldRaster->toImage();
|
||||
if (image == nil) return;
|
||||
|
||||
RwImage *resized = resizeImage(image, newWidth, newHeight);
|
||||
RwImageDestroy(image);
|
||||
if (resized == nil) return;
|
||||
|
||||
RwRaster *newRaster = rw::Raster::createFromImage(resized);
|
||||
RwImageDestroy(resized);
|
||||
if (newRaster == nil) return;
|
||||
|
||||
RwTextureSetRaster(texture, newRaster);
|
||||
RwRasterDestroy(oldRaster);
|
||||
}
|
||||
|
||||
#ifdef LIBRW
|
||||
#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
|
||||
#else
|
||||
|
|
@ -164,7 +257,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
|
|||
|
||||
#ifdef LIBRW
|
||||
|
||||
#define CAPSVERSION 0
|
||||
#define CAPSVERSION 1
|
||||
|
||||
struct GPUcaps
|
||||
{
|
||||
|
|
@ -397,7 +490,11 @@ CreateTxdImageForVideoCard()
|
|||
sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
|
||||
|
||||
if (CTxdStore::GetSlot(i)->texDict) {
|
||||
|
||||
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
|
||||
FORLIST(lnk, texDict->textures){
|
||||
rw::Texture *texture = rw::Texture::fromDict(lnk);
|
||||
downscaleTexture(texture);
|
||||
}
|
||||
int32 pos = STREAMTELL(img);
|
||||
|
||||
if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
|
||||
|
|
|
|||
|
|
@ -26,35 +26,19 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
|
|||
// Compatible with Linux/POSIX and MinGW on Windows
|
||||
#ifndef _WIN32
|
||||
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||
char pathCopy[MAX_PATH];
|
||||
strcpy(pathCopy, pathname);
|
||||
char newpathname[64];
|
||||
snprintf(newpathname, sizeof(newpathname), "E:/data/gta3/%s", pathname);
|
||||
char* path = strtok(newpathname, "\\*");
|
||||
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
||||
|
||||
char *folder = strtok(pathCopy, "*");
|
||||
char *extension = strtok(NULL, "*");
|
||||
|
||||
// because I remember like strtok might not return NULL for last delimiter
|
||||
if (extension && extension - folder == strlen(pathname))
|
||||
extension = nil;
|
||||
|
||||
// Case-sensitivity and backslashes...
|
||||
// Will be freed at the bottom
|
||||
char *realFolder = casepath(folder);
|
||||
if (realFolder) {
|
||||
folder = realFolder;
|
||||
}
|
||||
|
||||
strncpy(firstfile->folder, folder, sizeof(firstfile->folder));
|
||||
|
||||
if (extension)
|
||||
strncpy(firstfile->extension, extension, sizeof(firstfile->extension));
|
||||
// Both w/ extension and w/o extension is ok
|
||||
if (strlen(path) + 2 != strlen(pathname))
|
||||
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
|
||||
else
|
||||
firstfile->extension[0] = '\0';
|
||||
|
||||
if (realFolder)
|
||||
free(realFolder);
|
||||
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
||||
|
||||
HANDLE d;
|
||||
if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile))
|
||||
if ((d = (HANDLE)opendir(path)) == NULL || !FindNextFile(d, firstfile))
|
||||
return NULL;
|
||||
|
||||
return d;
|
||||
|
|
@ -67,12 +51,11 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
|
|||
int extensionLen = strlen(finddata->extension);
|
||||
while ((file = readdir((DIR*)d)) != NULL) {
|
||||
|
||||
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
||||
(extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
if ((extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
|
||||
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
||||
realpath(relativepath, path);
|
||||
// realpath(relativepath, path);
|
||||
strcpy(path, relativepath);
|
||||
stat(path, &fileStats);
|
||||
strncpy(finddata->cFileName, file->d_name, sizeof(finddata->cFileName));
|
||||
finddata->ftLastWriteTime = fileStats.st_mtime;
|
||||
|
|
@ -182,115 +165,26 @@ int _caserename(const char *old_filename, const char *new_filename)
|
|||
// Returned string should freed manually (if exists)
|
||||
char* casepath(char const* path, bool checkPathFirst)
|
||||
{
|
||||
if (checkPathFirst && access(path, F_OK) != -1) {
|
||||
// File path is correct
|
||||
return nil;
|
||||
}
|
||||
size_t l = strlen(path);
|
||||
char data_path[512];
|
||||
getcwd(data_path, sizeof(data_path));
|
||||
char* out = (char*)malloc(l + strlen(data_path) + 2);
|
||||
|
||||
size_t l = strlen(path);
|
||||
char* p = (char*)alloca(l + 1);
|
||||
char* out = (char*)malloc(l + 3); // for extra ./
|
||||
strcpy(p, path);
|
||||
if (strncmp(path, "E:", 2) == 0 || strncmp(path, "F:", 2) == 0) {
|
||||
strcpy(out, path);
|
||||
} else {
|
||||
sprintf(out, "%s/%s", data_path, path);
|
||||
}
|
||||
|
||||
// my addon: linux doesn't handle filenames with spaces at the end nicely
|
||||
p = trim(p);
|
||||
l = strlen(out);
|
||||
for (int i = l-1; i >= 0; i--) {
|
||||
if (out[i] == '\\' || out[i] == '/' || out[i] == ' ')
|
||||
out[i] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
size_t rl = 0;
|
||||
|
||||
DIR* d;
|
||||
char* c;
|
||||
|
||||
#if defined(__SWITCH__) || defined(PSP2)
|
||||
if( (c = strstr(p, ":/")) != NULL) // scheme used by some environments, eg. switch, vita
|
||||
{
|
||||
size_t deviceNameOffset = c - p + 3;
|
||||
char* deviceNamePath = (char*)alloca(deviceNameOffset + 1);
|
||||
strlcpy(deviceNamePath, p, deviceNameOffset);
|
||||
deviceNamePath[deviceNameOffset] = 0;
|
||||
d = opendir(deviceNamePath);
|
||||
p = c + 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (p[0] == '/' || p[0] == '\\')
|
||||
{
|
||||
d = opendir("/");
|
||||
}
|
||||
else
|
||||
{
|
||||
d = opendir(".");
|
||||
out[0] = '.';
|
||||
out[1] = 0;
|
||||
rl = 1;
|
||||
}
|
||||
|
||||
bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't)
|
||||
bool mayBeTrailingSlash = false;
|
||||
|
||||
while (c = strsep(&p, "/\\"))
|
||||
{
|
||||
// May be trailing slash(allow), slash at the start(avoid), or multiple slashes(avoid)
|
||||
if (*c == '\0')
|
||||
{
|
||||
mayBeTrailingSlash = true;
|
||||
continue;
|
||||
} else {
|
||||
mayBeTrailingSlash = false;
|
||||
}
|
||||
|
||||
out[rl] = '/';
|
||||
rl += 1;
|
||||
out[rl] = 0;
|
||||
|
||||
if (cantProceed)
|
||||
{
|
||||
strcpy(out + rl, c);
|
||||
rl += strlen(c);
|
||||
continue;
|
||||
}
|
||||
|
||||
struct dirent* e;
|
||||
while (e = readdir(d))
|
||||
{
|
||||
if (strcasecmp(c, e->d_name) == 0)
|
||||
{
|
||||
strcpy(out + rl, e->d_name);
|
||||
int reportedLen = (int)strlen(e->d_name);
|
||||
rl += reportedLen;
|
||||
assert(reportedLen == strlen(c) && "casepath: This is not good at all");
|
||||
|
||||
closedir(d);
|
||||
d = opendir(out);
|
||||
|
||||
// Either it wasn't a folder, or permission error, I/O error etc.
|
||||
if (!d) {
|
||||
cantProceed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e)
|
||||
{
|
||||
printf("casepath couldn't find dir/file \"%s\", full path was %s\n", c, path);
|
||||
// No match, add original name and continue converting further slashes.
|
||||
strcpy(out + rl, c);
|
||||
rl += strlen(c);
|
||||
cantProceed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (d) closedir(d);
|
||||
if (mayBeTrailingSlash) {
|
||||
out[rl] = '/'; rl += 1;
|
||||
out[rl] = '\0';
|
||||
}
|
||||
|
||||
if (rl > l + 2) {
|
||||
printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%zu chars)\n\tCorrected: %s (%zu chars)\n\n", path, l, out, rl);
|
||||
}
|
||||
return out;
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ int _caserename(const char *old_filename, const char *new_filename);
|
|||
#ifdef RW_GL3
|
||||
typedef struct
|
||||
{
|
||||
#ifndef __SYMBIAN32__
|
||||
GLFWwindow* window;
|
||||
#endif
|
||||
RwBool fullScreen;
|
||||
RwV2d lastMousePos;
|
||||
double mouseWheel; // glfw doesn't cache it
|
||||
|
|
@ -96,6 +98,12 @@ extern RwUInt32 gGameState;
|
|||
|
||||
RwBool IsForegroundApp();
|
||||
|
||||
#if !defined PATH_MAX
|
||||
#define PATH_MAX 260
|
||||
#endif
|
||||
#if !defined NAME_MAX
|
||||
#define NAME_MAX 120
|
||||
#endif
|
||||
#ifndef MAX_PATH
|
||||
#if !defined _WIN32 || defined __MINGW32__
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ extern "C"
|
|||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
extern RwUInt32 psTimer(void);
|
||||
#else
|
||||
extern double psTimer(void);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ static RwBool DefaultVideoMode = TRUE;
|
|||
|
||||
RsGlobalType RsGlobal;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined __SYMBIAN32__
|
||||
RwUInt32
|
||||
#else
|
||||
double
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ extern RwBool
|
|||
RsInputDeviceAttach(RsInputDeviceType inputDevice,
|
||||
RsInputEventHandler inputEventHandler);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined __SYMBIAN32__
|
||||
extern RwUInt32
|
||||
#else
|
||||
extern double
|
||||
|
|
|
|||
586
src/skel/symbian/symbian.cpp
Normal file
586
src/skel/symbian/symbian.cpp
Normal file
|
|
@ -0,0 +1,586 @@
|
|||
#include <e32base.h>
|
||||
#include <e32keys.h>
|
||||
#include <coemain.h>
|
||||
#include <w32std.h>
|
||||
#include <aknapp.h>
|
||||
#include <akndoc.h>
|
||||
#include <aknappui.h>
|
||||
#include <coecntrl.h>
|
||||
#include <eikstart.h>
|
||||
#include <hal.h>
|
||||
#include <pthread.h>
|
||||
#include <gles2/gl2.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "rwcore.h"
|
||||
#include "skel/skeleton.h"
|
||||
#include "platform.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Pad.h"
|
||||
#include "DMAudio.h"
|
||||
#include "ControllerConfig.h"
|
||||
#include "Frontend.h"
|
||||
#include "Game.h"
|
||||
#include "PCSave.h"
|
||||
#include "MemoryCard.h"
|
||||
#include "Sprite2d.h"
|
||||
#include "AnimViewer.h"
|
||||
#include "MemoryMgr.h"
|
||||
#include "Text.h"
|
||||
#include "Timer.h"
|
||||
|
||||
psGlobalType psGlobal;
|
||||
|
||||
uint32 gGameState = 0;
|
||||
long _dwOperatingSystemVersion = 0;
|
||||
uint32 _dwMemAvailPhys = 0;
|
||||
|
||||
static EGLDisplay eglDisplay;
|
||||
static EGLContext eglContext;
|
||||
static EGLSurface eglSurface;
|
||||
static EGLConfig eglConfig;
|
||||
|
||||
rw::EngineOpenParams openParams;
|
||||
|
||||
const TUid KUidRE3 = {0xe0d67647};
|
||||
|
||||
#define JOY_A 0 // cross
|
||||
#define JOY_B 1 // circle
|
||||
#define JOY_X 2 // square
|
||||
#define JOY_Y 3 // triangle
|
||||
#define JOY_LB 6
|
||||
#define JOY_RB 7
|
||||
#define JOY_START 11
|
||||
#define JOY_DPAD_UP 12
|
||||
#define JOY_DPAD_RIGHT 13
|
||||
#define JOY_DPAD_DOWN 14
|
||||
#define JOY_DPAD_LEFT 15
|
||||
|
||||
static uint8 virtualButtons[17] = { 0 };
|
||||
static float virtualLeftStickX = 0.0f;
|
||||
static float virtualLeftStickY = 0.0f;
|
||||
static float virtualRightStickX = 0.0f;
|
||||
static float virtualRightStickY = 0.0f;
|
||||
|
||||
static TInt tickPeriod;
|
||||
static uint32 cyclesPerMS;
|
||||
|
||||
static psGlobalType PsGlobal;
|
||||
|
||||
static TBool foreground;
|
||||
|
||||
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
||||
}
|
||||
|
||||
const char* _psGetUserFilesFolder() {
|
||||
return "E:\\Data\\gta3\\";
|
||||
}
|
||||
|
||||
void HandleExit() {
|
||||
}
|
||||
|
||||
RwInt32 _psGetNumVideModes() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
RwChar** _psGetVideoModeList() {
|
||||
static RwChar* modes[] = { (RwChar*)"Native" };
|
||||
return modes;
|
||||
}
|
||||
|
||||
void _psSelectScreenVM(RwInt32 videoMode) {
|
||||
RwTexDictionarySetCurrent( nil );
|
||||
FrontEndMenuManager.UnloadTextures();
|
||||
FrontEndMenuManager.LoadAllTextures();
|
||||
}
|
||||
|
||||
void CapturePad(int padID) {
|
||||
if (padID != 0) return;
|
||||
|
||||
if (!ControlsManager.m_bFirstCapture) {
|
||||
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
|
||||
} else {
|
||||
memset(&ControlsManager.m_OldState, 0, sizeof(ControlsManager.m_OldState));
|
||||
}
|
||||
|
||||
ControlsManager.m_NewState.buttons = virtualButtons;
|
||||
ControlsManager.m_NewState.numButtons = 17;
|
||||
ControlsManager.m_NewState.id = 0;
|
||||
ControlsManager.m_NewState.isGamepad = true;
|
||||
|
||||
memcpy(ControlsManager.m_NewState.mappedButtons, virtualButtons, 17);
|
||||
|
||||
if (ControlsManager.m_bFirstCapture) {
|
||||
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
|
||||
ControlsManager.m_bFirstCapture = false;
|
||||
}
|
||||
|
||||
RsPadButtonStatus bs;
|
||||
bs.padID = padID;
|
||||
|
||||
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
|
||||
|
||||
{
|
||||
if (CPad::m_bMapPadOneToPadTwo)
|
||||
bs.padID = 1;
|
||||
|
||||
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
|
||||
RsPadEventHandler(rsPADBUTTONDOWN, (void *)&bs);
|
||||
}
|
||||
|
||||
CPad *pad = CPad::GetPad(0);
|
||||
pad->PCTempJoyState.LeftStickX = (int32)(virtualLeftStickX * 128.0f);
|
||||
pad->PCTempJoyState.LeftStickY = (int32)(virtualLeftStickY * 128.0f);
|
||||
pad->PCTempJoyState.RightStickX = (int32)(virtualRightStickX * 128.0f);
|
||||
pad->PCTempJoyState.RightStickY = (int32)(virtualRightStickY * 128.0f);
|
||||
}
|
||||
|
||||
RwBool psCameraBeginUpdate(RwCamera *camera) {
|
||||
RwCameraBeginUpdate(camera);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psCameraShowRaster(RwCamera *camera) {
|
||||
RwCameraShowRaster(camera, NULL, 0);
|
||||
}
|
||||
|
||||
RwMemoryFunctions* psGetMemoryFunctions(void) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
RwImage* psGrabScreen(RwCamera *camera) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RwBool psInstallFileSystem(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psMouseSetPos(RwV2d *pos) {
|
||||
}
|
||||
|
||||
RwBool psNativeTextureSupport(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RwBool psSelectDevice(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psTerminate(void) {
|
||||
}
|
||||
|
||||
RwBool psInitialize(void) {
|
||||
CFileMgr::Initialise();
|
||||
TInt memFree = 0;
|
||||
if (HAL::Get(HALData::EMemoryRAMFree, memFree) == KErrNone) {
|
||||
if (memFree > 40 * 1024 * 1024) {
|
||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
||||
} else if (memFree <= 0) {
|
||||
_dwMemAvailPhys = 10 * 1024 * 1024;
|
||||
} else {
|
||||
_dwMemAvailPhys = memFree;
|
||||
}
|
||||
} else {
|
||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
||||
}
|
||||
|
||||
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RwUInt32 psTimer(void) {
|
||||
// return (RwUInt32)User::NTickCount();
|
||||
TTime time;
|
||||
time.HomeTime();
|
||||
return (RwUInt32)(time.Int64() / 1000);
|
||||
}
|
||||
|
||||
namespace sk {
|
||||
void SetMousePosition(int x, int y) {}
|
||||
}
|
||||
|
||||
|
||||
extern "C" void RDebug_Printf(const char*, ...);
|
||||
void RDebug_Printf(const char* c, ...)
|
||||
{
|
||||
VA_LIST list;
|
||||
VA_START(list, c);
|
||||
TBuf8<0x100> buf;
|
||||
TPtrC8 des((const TUint8 *)c);
|
||||
buf.FormatList(des, list);
|
||||
RDebug::RawPrint(buf);
|
||||
}
|
||||
|
||||
uint32 CTimer::GetCyclesPerMillisecond(void) {
|
||||
// return cyclesPerMS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
RwBool IsForegroundApp() {
|
||||
return foreground;
|
||||
}
|
||||
|
||||
class CCContainer : public CCoeControl {
|
||||
public:
|
||||
CAknAppUi* iAppUi;
|
||||
CPeriodic* iPeriodic;
|
||||
RwUInt32 gGameState;
|
||||
static TInt LoopCallBack(TAny* p) {
|
||||
CCContainer* container = (CCContainer*) p;
|
||||
if(RsGlobal.quit) {
|
||||
RsEventHandler(rsRWTERMINATE, nil);
|
||||
container->iAppUi->Exit();
|
||||
return EFalse;
|
||||
}
|
||||
|
||||
switch (container->gGameState) {
|
||||
case GS_START_UP:
|
||||
foreground = true;
|
||||
if (HAL::Get(HAL::ENanoTickPeriod, tickPeriod) != KErrNone) {
|
||||
User::Panic(_L("Could not init timer"), 0);
|
||||
}
|
||||
cyclesPerMS = 1000 / tickPeriod;
|
||||
if (cyclesPerMS < 1) cyclesPerMS = 1;
|
||||
container->gGameState = GS_INIT_ONCE;
|
||||
break;
|
||||
case GS_INIT_ONCE:
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
if ( !CGame::InitialiseOnceAfterRW() ) {
|
||||
RsGlobal.quit = TRUE;
|
||||
return ETrue;
|
||||
}
|
||||
// container->gGameState = GS_INIT_FRONTEND;
|
||||
container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
break;
|
||||
case GS_INIT_FRONTEND:
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
|
||||
FrontEndMenuManager.m_bGameNotLoaded = true;
|
||||
|
||||
CMenuManager::m_bStartUpFrontEndRequested = true;
|
||||
|
||||
container->gGameState = GS_FRONTEND;
|
||||
|
||||
// container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
break;
|
||||
case GS_FRONTEND:
|
||||
RsEventHandler(rsFRONTENDIDLE, nil);
|
||||
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
|
||||
{
|
||||
container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_INIT_PLAYING_GAME;");
|
||||
}
|
||||
if ( FrontEndMenuManager.m_bWantToLoad )
|
||||
{
|
||||
InitialiseGame();
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
container->gGameState = GS_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_PLAYING_GAME;");
|
||||
}
|
||||
break;
|
||||
case GS_INIT_PLAYING_GAME:
|
||||
InitialiseGame();
|
||||
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
container->gGameState = GS_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_PLAYING_GAME;");
|
||||
break;
|
||||
case GS_PLAYING_GAME:
|
||||
// float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)tickPeriod; //(float)CTimer::GetCyclesPerMillisecond();
|
||||
// if ( RwInitialised )
|
||||
// {
|
||||
// if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms)
|
||||
RsEventHandler(rsIDLE, (void *)TRUE);
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsForegroundApp()) {
|
||||
User::ResetInactivityTime();
|
||||
}
|
||||
|
||||
return ETrue;
|
||||
}
|
||||
|
||||
void RestartTimerL(TInt aInterval) {
|
||||
if (iPeriodic) iPeriodic->Cancel();
|
||||
else iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
|
||||
iPeriodic->Start(aInterval, aInterval, TCallBack(CCContainer::LoopCallBack, this));
|
||||
}
|
||||
|
||||
void ConstructL(const TRect& aRect, CAknAppUi* aAppUi) {
|
||||
iAppUi = aAppUi;
|
||||
CreateWindowL();
|
||||
SetExtentToWholeScreen();
|
||||
Window().EnableAdvancedPointers();
|
||||
EnableDragEvents();
|
||||
ActivateL();
|
||||
|
||||
TSize size = Size();
|
||||
RsGlobal.width = size.iWidth;
|
||||
RsGlobal.height = size.iHeight;
|
||||
|
||||
EGLint attribs[] = {
|
||||
EGL_BUFFER_SIZE, 16,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_STENCIL_SIZE, 0,
|
||||
EGL_SAMPLES, 0,
|
||||
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
eglInitialize(eglDisplay, NULL, NULL);
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
EGLint numConfigs;
|
||||
eglChooseConfig(eglDisplay, attribs, &eglConfig, 1, &numConfigs);
|
||||
|
||||
EGLint contextAttribs[ 3 ] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
|
||||
eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs);
|
||||
|
||||
RWindow& window = Window();
|
||||
eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, &window, NULL);
|
||||
|
||||
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale(LC_CTYPE, "C");
|
||||
setlocale(LC_COLLATE, "C");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
chdir("E:\\Data\\gta3\\");
|
||||
gGameState = GS_START_UP;
|
||||
FrontEndMenuManager.LoadSettings();
|
||||
CMenuManager::OS_Language = LANG_ENGLISH;
|
||||
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
|
||||
TheText.Unload();
|
||||
TheText.Load();
|
||||
|
||||
chdir("E:\\Data\\gta3\\");
|
||||
if(RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR) return;
|
||||
|
||||
openParams.width = RsGlobal.width;
|
||||
openParams.height = RsGlobal.height;
|
||||
openParams.windowtitle = RsGlobal.appName;
|
||||
|
||||
ControlsManager.MakeControllerActionsBlank();
|
||||
ControlsManager.InitDefaultControlConfiguration();
|
||||
|
||||
if(RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR) return;
|
||||
|
||||
CPad::GetPad(0)->Clear(true);
|
||||
CPad::GetPad(1)->Clear(true);
|
||||
|
||||
PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f;
|
||||
RsGlobal.ps = &PsGlobal;
|
||||
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(15);
|
||||
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
|
||||
|
||||
{
|
||||
RwRect r;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.w = RsGlobal.maximumWidth;
|
||||
r.h = RsGlobal.maximumHeight;
|
||||
|
||||
RsEventHandler(rsCAMERASIZE, &r);
|
||||
}
|
||||
|
||||
RestartTimerL(10000);
|
||||
}
|
||||
|
||||
virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent) {
|
||||
int x = aPointerEvent.iPosition.iX;
|
||||
int y = aPointerEvent.iPosition.iY;
|
||||
int w = RsGlobal.width;
|
||||
int h = RsGlobal.height;
|
||||
|
||||
// if (FrontEndMenuManager.m_bMenuActive) {
|
||||
// PSGLOBAL(lastMousePos).x = x;
|
||||
// PSGLOBAL(lastMousePos).y = y;
|
||||
// FrontEndMenuManager.m_nMouseTempPosX = x;
|
||||
// FrontEndMenuManager.m_nMouseTempPosY = y;
|
||||
//
|
||||
// if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
|
||||
// CPad::GetPad(0)->PCTempMouseControllerState.LMB = true;
|
||||
// } else if (aPointerEvent.iType == TPointerEvent::EButton1Up) {
|
||||
// CPad::GetPad(0)->PCTempMouseControllerState.RMB = false;
|
||||
// }
|
||||
// CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
// return;
|
||||
// }
|
||||
|
||||
const TAdvancedPointerEvent* advpointer = aPointerEvent.AdvancedPointerEvent();
|
||||
int i = advpointer != NULL ? advpointer->PointerNumber() : 0;
|
||||
|
||||
static int activeZone[10];
|
||||
static int stickCenterX[10];
|
||||
static int stickCenterY[10];
|
||||
|
||||
if (i > 9) {
|
||||
CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
|
||||
if (x < w / 3 && y > h / 4) {
|
||||
// bottom left: left stick
|
||||
activeZone[i] = 1;
|
||||
stickCenterX[i] = x;
|
||||
stickCenterY[i] = y;
|
||||
} else if (x > w * 2 / 3 && y > h / 4) {
|
||||
// bottom right: right stick
|
||||
activeZone[i] = 2;
|
||||
stickCenterX[i] = x;
|
||||
stickCenterY[i] = y;
|
||||
} else if (x > w - (w / 5) && y < h / 4) {
|
||||
// top right: enter/exit
|
||||
activeZone[i] = 3;
|
||||
virtualButtons[JOY_Y] = 1;
|
||||
} else if (x < w / 5 && y < h / 4) {
|
||||
// top left: brake
|
||||
activeZone[i] = 4;
|
||||
virtualButtons[JOY_X] = 1;
|
||||
} else {
|
||||
// gas
|
||||
activeZone[i] = 5;
|
||||
virtualButtons[JOY_B] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EDrag) {
|
||||
if (activeZone[i] == 1 || activeZone[i] == 2) {
|
||||
float dx = (float)(x - stickCenterX[i]) / (w / 8.0f);
|
||||
float dy = (float)(y - stickCenterY[i]) / (h / 6.0f);
|
||||
|
||||
if (dx < -1.0f) dx = -1.0f;
|
||||
if (dx > 1.0f) dx = 1.0f;
|
||||
if (dy < -1.0f) dy = -1.0f;
|
||||
if (dy > 1.0f) dy = 1.0f;
|
||||
|
||||
if (activeZone[i] == 1) {
|
||||
virtualLeftStickX = dx;
|
||||
virtualLeftStickY = dy;
|
||||
} else {
|
||||
virtualRightStickX = dx;
|
||||
virtualRightStickY = dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EButton1Up) {
|
||||
if (activeZone[i] == 1) {
|
||||
virtualLeftStickX = 0.0f;
|
||||
virtualLeftStickY = 0.0f;
|
||||
} else if (activeZone[i] == 2) {
|
||||
virtualRightStickX = 0.0f;
|
||||
virtualRightStickY = 0.0f;
|
||||
} else if (activeZone[i] == 3) {
|
||||
virtualButtons[JOY_Y] = 0;
|
||||
} else if (activeZone[i] == 4) {
|
||||
virtualButtons[JOY_X] = 0;
|
||||
} else if (activeZone[i] == 5) {
|
||||
virtualButtons[JOY_B] = 0;
|
||||
}
|
||||
activeZone[i] = 0;
|
||||
}
|
||||
|
||||
CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
}
|
||||
};
|
||||
|
||||
class RE3AppUi : public CAknAppUi {
|
||||
CCContainer* iContainer;
|
||||
public:
|
||||
void ConstructL() {
|
||||
BaseConstructL(CAknAppUi::EAknEnableSkin);
|
||||
iContainer = new (ELeave) CCContainer;
|
||||
iContainer->SetMopParent(this);
|
||||
iContainer->ConstructL(ClientRect(), this);
|
||||
AddToStackL(iContainer);
|
||||
}
|
||||
void HandleForegroundEventL(TBool aForeground) {
|
||||
foreground = aForeground;
|
||||
}
|
||||
|
||||
~RE3AppUi() {
|
||||
if (iContainer) {
|
||||
RemoveFromStack(iContainer);
|
||||
delete iContainer;
|
||||
}
|
||||
}
|
||||
void HandleCommandL(TInt aCommand) {
|
||||
if (aCommand == EAknSoftkeyBack || aCommand == EEikCmdExit) {
|
||||
RsGlobal.quit = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class RE3Document: public CAknDocument {
|
||||
public:
|
||||
static RE3Document* NewL(CEikApplication& aApp);
|
||||
virtual ~RE3Document();
|
||||
protected:
|
||||
void ConstructL();
|
||||
public:
|
||||
RE3Document(CEikApplication& aApp);
|
||||
private:
|
||||
CEikAppUi* CreateAppUiL();
|
||||
};
|
||||
|
||||
RE3Document::RE3Document(CEikApplication& aApp) : CAknDocument(aApp) {}
|
||||
|
||||
RE3Document::~RE3Document() {}
|
||||
|
||||
void RE3Document::ConstructL() {}
|
||||
|
||||
RE3Document* RE3Document::NewL(CEikApplication& aApp) {
|
||||
RE3Document* self = new (ELeave) RE3Document(aApp);
|
||||
CleanupStack::PushL(self);
|
||||
self->ConstructL();
|
||||
CleanupStack::Pop();
|
||||
return self;
|
||||
}
|
||||
|
||||
CEikAppUi* RE3Document::CreateAppUiL() {
|
||||
return new (ELeave) RE3AppUi;
|
||||
}
|
||||
|
||||
class RE3App: public CAknApplication {
|
||||
private:
|
||||
CApaDocument* CreateDocumentL();
|
||||
TUid AppDllUid() const;
|
||||
};
|
||||
|
||||
LOCAL_C CApaApplication* NewApplication();
|
||||
|
||||
GLDEF_C TInt E32Main();
|
||||
|
||||
TUid RE3App::AppDllUid() const {
|
||||
return KUidRE3;
|
||||
}
|
||||
|
||||
CApaDocument* RE3App::CreateDocumentL() {
|
||||
return RE3Document::NewL(*this);
|
||||
}
|
||||
|
||||
CApaApplication* NewApplication() {
|
||||
return new RE3App;
|
||||
}
|
||||
|
||||
TInt E32Main() {
|
||||
User::SetFloatingPointMode(EFpModeRunFast);
|
||||
return EikStart::RunApplication(NewApplication);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue