diff --git a/TODO.md b/TODO.md index 698f30f..26cc810 100644 --- a/TODO.md +++ b/TODO.md @@ -3,15 +3,15 @@ Common: - [x] Window implementation - [x] Fix shader compilation - [x] Downscale textures +- [ ] Simplify geometry - [x] Touch controls - [x] Keyboard controls +- [ ] Audio? - [x] Menu - [x] Config - [x] Merge S60v3 and ^3 branches -- [ ] Simplify geometry - [ ] Move map to top left corner - [ ] Do something with sprites, they're still taking too much frame time -- [ ] Audio GLES 2.0 specific: - [x] Optimize to always run 10+ fps @@ -19,20 +19,15 @@ GLES 2.0 specific: - [ ] Optimize to always run 20+ fps - [ ] Use etc1 compression - [ ] Fix face animations in optimized builds -- [ ] Skinning shader is still broken on VC4 -- [ ] Disappearing background in cutscenes -- [ ] HUD still disappearing sometimes GLES 1.1 specific: - [x] Backport to STLport v4 - [x] GLES 1.1 engine -- [x] Keyboard mappings for both QWERTY/12-keys +- [ ] Keyboard mappings for both QWERTY/12-keys - [ ] Use pvrtc compression -- [ ] Optimize to always run 10+ fps -- [ ] Fix z-buffer issues (world clips through hud) -- [ ] Fix lighting Issues: - [x] Fix crash in Texture::destroy on exit - [x] Save menu is too slow +- [x] HUD disappearing on GLES 2.0 (mostly fixed, was caused by OOM) - [x] Crash when picking up a bat diff --git a/group/bld.inf b/group/bld.inf index 93771b3..bcb0a2f 100644 --- a/group/bld.inf +++ b/group/bld.inf @@ -2,7 +2,6 @@ PRJ_PLATFORMS DEFAULT ARMV6 PRJ_MMPFILES -gnumakefile Icons_scalable_dc.mk gnumakefile shaders.mk librw_gles2.mmp re3_gles2.mmp diff --git a/group/common.mmh b/group/common.mmh index e04e11c..3c7bbaf 100644 --- a/group/common.mmh +++ b/group/common.mmh @@ -17,9 +17,8 @@ SRCDBG OPTION ARMCC --gnu -Otime --diag_suppress 1,68,111,174,381,1293 OPTION_REPLACE ARMCC --cpu 6 -OPTION_REPLACE ARMCC --fpu vfpv2 --fpmode fast -// too dangerous! -OPTION_REPLACE ARMCC -O2 -O3 +OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast +OPTION_REPLACE ARMCC -O2 -O3 // too dangerous! #ifdef ARMCC ALWAYS_BUILD_AS_ARM #endif @@ -28,10 +27,10 @@ ALWAYS_BUILD_AS_ARM SYSTEMINCLUDE /epoc32/include/stdapis/stlportv5 STDCPP MACRO RW_GL3 -MACRO RW_OPENGL +MACRO RW_OPENGL // because carbide is too stupid #else SYSTEMINCLUDE /epoc32/include/stdapis/stlport SYSTEMINCLUDE /epoc32/include/stdapis/stlport/stl MACRO RW_GLES1 -MACRO S60V3 +MACRO S60V5 #endif diff --git a/group/librw_gles1.mmp b/group/librw_gles1.mmp index 4d2e805..0ed82e4 100644 --- a/group/librw_gles1.mmp +++ b/group/librw_gles1.mmp @@ -1,3 +1,4 @@ #undef SYMBIAN3 +#define S60V3 TARGET librw_gles1.lib #include "librw.mmh" \ No newline at end of file diff --git a/group/librw_gles2.mmp b/group/librw_gles2.mmp index d33a32e..b161ff5 100644 --- a/group/librw_gles2.mmp +++ b/group/librw_gles2.mmp @@ -1,3 +1,4 @@ +#undef S60V3 #define SYMBIAN_3 TARGET librw_gles2.lib #include "librw.mmh" \ No newline at end of file diff --git a/group/re3_gles1.mmp b/group/re3_gles1.mmp index bade9b7..79ed835 100644 --- a/group/re3_gles1.mmp +++ b/group/re3_gles1.mmp @@ -1,4 +1,5 @@ #undef SYMBIAN_3 +#define S60V3 //TARGET re3_gles1.exe TARGET re3_gles1.exe LIBRARY libstdcpp.lib diff --git a/group/re3_gles2.mmp b/group/re3_gles2.mmp index 5d2a0d0..b440269 100644 --- a/group/re3_gles2.mmp +++ b/group/re3_gles2.mmp @@ -1,3 +1,4 @@ +#undef S60V3 #define SYMBIAN_3 TARGET re3.exe LIBRARY libstdcppv5.lib @@ -5,6 +6,5 @@ LIBRARY libglesv2.lib LIBRARY libegl.lib LIBRARY platformver.lib STATICLIBRARY librw_gles2.lib -ARMFPU vfpv2 -SMPSAFE +ARMFPU softvfp+vfpv2 #include "re3.mmh" \ No newline at end of file diff --git a/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index b20c89d..b76f1c5 100644 --- a/sis/re3-gles1.pkg +++ b/sis/re3-gles1.pkg @@ -1,26 +1,22 @@ -#{"GTA III"},(0xe0d67647),1,0,1 +#{"GTA III"},(0xe0d67647),1,0,0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 -[0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 -[0x20022E6D], 0, 0, 0, {"S60ProductID"} ; ^3 +[0x101F7961], 0, 0, 0, {"S60ProductID"} +[0x1028315F], 0, 0, 0, {"S60ProductID"} +[0x20022E6D], 0, 0, 0, {"S60ProductID"} %{"nnproject"} :"nnproject" +;IF (NOT package(0x20009A80)) OR (NOT package(0x2002372A)) ; old or missing openc +; "incompatible_openc.txt"-"", FT, FORCEABORT +;ENDIF + +;IF exists("z:\system\install\Series60v5.2.sis") AND exists("z:\sys\bin\libGLESv2.dll") +; "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3.exe"-"!:\sys\bin\re3.exe" +;ELSE +; "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3_gles1.exe"-"!:\sys\bin\re3.exe" +;ENDIF "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3_gles1.exe"-"!:\sys\bin\re3.exe" "$(EPOCROOT)\epoc32\data\z\private\10003a3f\import\apps\re3_reg.rsc" - "!:\private\10003a3f\import\apps\re3_reg.rsc" "$(EPOCROOT)\epoc32\data\z\resource\apps\re3.rsc" - "!:\resource\apps\re3.rsc" -"$(EPOCROOT)\epoc32\data\z\resource\apps\re3_icon.mif" - "!:\resource\apps\re3_icon.mif" - -"..\gamefiles\data\PARTICLE.CFG" - "E:\data\gta3\data\PARTICLE.CFG" -"..\gamefiles\models\fonts_j.txd" - "E:\data\gta3\models\fonts_j.txd" -"..\gamefiles\models\fonts_p.txd" - "E:\data\gta3\models\fonts_p.txd" -"..\gamefiles\models\fonts_r.txd" - "E:\data\gta3\models\fonts_r.txd" -"..\gamefiles\TEXT\american.gxt" - "E:\data\gta3\TEXT\american.gxt" -"..\gamefiles\TEXT\english.gxt" - "E:\data\gta3\TEXT\english.gxt" -"..\gamefiles\TEXT\french.gxt" - "E:\data\gta3\TEXT\french.gxt" -"..\gamefiles\TEXT\german.gxt" - "E:\data\gta3\TEXT\german.gxt" -"..\gamefiles\TEXT\italian.gxt" - "E:\data\gta3\TEXT\italian.gxt" -"..\gamefiles\TEXT\JAPANESE.gxt" - "E:\data\gta3\TEXT\JAPANESE.gxt" -"..\gamefiles\TEXT\polish.gxt" - "E:\data\gta3\TEXT\polish.gxt" -"..\gamefiles\TEXT\spanish.gxt" - "E:\data\gta3\TEXT\spanish.gxt" +"$(EPOCROOT)\epoc32\data\z\resource\apps\re3_icon.mif" - "!:\resource\apps\re3_icon.mif" \ No newline at end of file diff --git a/sis/re3.pkg b/sis/re3.pkg index 84887fd..1c9097c 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,8 +1,8 @@ -#{"GTA III"},(0xe0d67647),1,0,1 +#{"GTA III"},(0xe0d67647),1,0,0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 -[0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 -[0x20022E6D], 0, 0, 0, {"S60ProductID"} ; ^3 +[0x101F7961], 0, 0, 0, {"S60ProductID"} +[0x1028315F], 0, 0, 0, {"S60ProductID"} +[0x20022E6D], 0, 0, 0, {"S60ProductID"} %{"nnproject"} :"nnproject" @@ -11,24 +11,12 @@ IF (NOT package(0x20009A80)) OR (NOT package(0x2002372A)) ; old or missing openc "incompatible_openc.txt"-"", FT, FORCEABORT ENDIF -IF exists("z:\system\install\Series60v5.2.sis") AND exists("z:\sys\bin\libGLESv2.dll") ; ^3 +IF exists("z:\system\install\Series60v5.2.sis") AND exists("z:\sys\bin\libGLESv2.dll") "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3.exe"-"!:\sys\bin\re3.exe" -ELSE ; everything else +ELSE "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3_gles1.exe"-"!:\sys\bin\re3.exe" ENDIF +;"$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3.exe"-"!:\sys\bin\re3.exe" "$(EPOCROOT)\epoc32\data\z\private\10003a3f\import\apps\re3_reg.rsc" - "!:\private\10003a3f\import\apps\re3_reg.rsc" "$(EPOCROOT)\epoc32\data\z\resource\apps\re3.rsc" - "!:\resource\apps\re3.rsc" "$(EPOCROOT)\epoc32\data\z\resource\apps\re3_icon.mif" - "!:\resource\apps\re3_icon.mif" - -"..\gamefiles\data\PARTICLE.CFG" - "E:\data\gta3\data\PARTICLE.CFG" -"..\gamefiles\models\fonts_j.txd" - "E:\data\gta3\models\fonts_j.txd" -"..\gamefiles\models\fonts_p.txd" - "E:\data\gta3\models\fonts_p.txd" -"..\gamefiles\models\fonts_r.txd" - "E:\data\gta3\models\fonts_r.txd" -"..\gamefiles\TEXT\american.gxt" - "E:\data\gta3\TEXT\american.gxt" -"..\gamefiles\TEXT\english.gxt" - "E:\data\gta3\TEXT\english.gxt" -"..\gamefiles\TEXT\french.gxt" - "E:\data\gta3\TEXT\french.gxt" -"..\gamefiles\TEXT\german.gxt" - "E:\data\gta3\TEXT\german.gxt" -"..\gamefiles\TEXT\italian.gxt" - "E:\data\gta3\TEXT\italian.gxt" -"..\gamefiles\TEXT\JAPANESE.gxt" - "E:\data\gta3\TEXT\JAPANESE.gxt" -"..\gamefiles\TEXT\polish.gxt" - "E:\data\gta3\TEXT\polish.gxt" -"..\gamefiles\TEXT\spanish.gxt" - "E:\data\gta3\TEXT\spanish.gxt" diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index e27ebcf..8faa6c2 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3689,7 +3689,6 @@ const char* controllerTypesPaths[] = { void CMenuManager::LoadController(int8 type) { -#ifdef BUTTON_ICONS switch (type) { case CONTROLLER_DUALSHOCK2: @@ -3704,8 +3703,7 @@ CMenuManager::LoadController(int8 type) CFont::LoadButtons("MODELS/X360BTNS.TXD"); break; } -#endif - + // Unload current textures for (int i = FE_CONTROLLER; i <= FE_ARROWS4; i++) m_aFrontEndSprites[i].Delete(); @@ -5142,9 +5140,6 @@ CMenuManager::ProcessButtonPresses(void) ControlsManager.MakeControllerActionsBlank(); ControlsManager.InitDefaultControlConfiguration(); ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp()); -#if defined __SYMBIAN32__ - m_ControlMethod = CONTROL_CLASSIC; -#else #if !defined RW_GL3 && !defined RW_GLES1 if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) { DIDEVCAPS devCaps; @@ -5152,6 +5147,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; @@ -5160,7 +5157,6 @@ CMenuManager::ProcessButtonPresses(void) } #endif m_ControlMethod = CONTROL_STANDARD; -#endif #ifdef FIX_BUGS MousePointerStateHelper.bInvertVertically = true; TheCamera.m_fMouseAccelVertical = 0.003f; diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 56192ea..03b399d 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -16,8 +16,7 @@ #include "Renderer.h" #if defined __ARMCC_VERSION && !defined _DEBUG -// fixes crash -#pragma O2 +#pragma O2 // fixes crash #endif int32 CCullZones::NumCullZones; diff --git a/src/core/config.h b/src/core/config.h index 56a689e..b7baed8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -342,7 +342,7 @@ enum Config { #define ALT_DODO_CHEAT #define REGISTER_START_BUTTON #define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls -//#define BUTTON_ICONS // use textures to show controller buttons +#define BUTTON_ICONS // use textures to show controller buttons // Hud, frontend and radar //#define PS2_HUD diff --git a/src/core/main.cpp b/src/core/main.cpp index d44fe99..87484ee 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1448,21 +1448,17 @@ RenderEffects(void) CGlass::Render(); CWaterCannons::Render(); CSpecialFX::Render(); - #ifdef RW_GLES1 - CShadows::RenderStaticShadows(); - CShadows::RenderStoredShadows(); - CSkidmarks::Render(); - CAntennas::Render(); - CRubbish::Render(); - CCoronas::Render(); - #endif +// CShadows::RenderStaticShadows(); +// CShadows::RenderStoredShadows(); +// CSkidmarks::Render(); +// CAntennas::Render(); +// CRubbish::Render(); +// CCoronas::Render(); CParticle::Render(); CPacManPickups::Render(); - #ifdef RW_GLES1 - CWeaponEffects::Render(); - CPointLights::RenderFogEffect(); - CMovingThings::Render(); - #endif +// CWeaponEffects::Render(); +// CPointLights::RenderFogEffect(); +// CMovingThings::Render(); CRenderer::RenderFirstPersonVehicle(); POP_RENDERGROUP(); } diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp index 8f01fe0..c0621f8 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -84,6 +84,9 @@ void tbEndTimer(Const char* name) } assert(n != 1500); TimerBar.Timers[n].endTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerFrame(); + if (strcmp(name, "EndOfFrame")) { + endOfFrameTime = TimerBar.Timers[n].endTime - TimerBar.Timers[n].startTime; + } } float Diag_GetFPS() diff --git a/src/math/math.cpp b/src/math/math.cpp index ff86039..8cb56da 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -80,12 +80,7 @@ void TransformPoints(CVuVector *out, int n, const CMatrix &mat, const RwV3d *in, ": : "r" (out) , "r" (n), "r" (&mat), "r" (in), "r" (stride): "memory"); #else while(n--){ -#ifdef S60V3 - const RwV3d i = *in; - *out = mat * i; -#else *out = mat * *in; -#endif in = (RwV3d*)((uint8*)in + stride); out++; } @@ -115,12 +110,7 @@ void TransformPoints(CVuVector *out, int n, const CMatrix &mat, const CVuVector ": : "r" (out) , "r" (n), "r" (&mat) ,"r" (in): "memory"); #else while(n--){ -#ifdef S60V3 - const RwV3d i = *in; - *out = mat * i; -#else *out = mat * *in; -#endif in++; out++; } diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index e44a208..4876f79 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1,6 +1,5 @@ #if defined __ARMCC_VERSION && !defined _DEBUG -// fixes crash -#pragma O2 +#pragma O2 // fixes crash #endif #include "common.h" diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index 7b9e0dd..dacec8b 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -1355,25 +1355,19 @@ void CHud::DrawAfterFade() CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); PRINT("start", 320 + 20, 290 + y, 60); - // l3, r3 - CSprite2d::DrawRect(CRECT(320 - 80, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); - PRINT("L3", 320 - 80, 258 + y, 60); - CSprite2d::DrawRect(CRECT(320 + 20, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); - PRINT("R3", 320 + 20, 258 + y, 60); - // dpad CSprite2d::DrawRect(CRECT(0, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); - PRINT("\"", w / 8 - 15, 90 + y, 30); + PRINT("/\\", w / 8 - 15, 90 + y, 30); PRINT("v", w / 8 - 15, 160 + y, 30); PRINT("<", w / 8 - 60, 125 + y, 30); PRINT(">", w / 8 + 30, 125 + y, 30); // abxy CSprite2d::DrawRect(CRECT(w - w / 4, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); - PRINT("\"", w - w / 8 - 15, 90 + y, 30); + PRINT("/\\", w - w / 8 - 15, 90 + y, 30); PRINT("X", w - w / 8 - 15, 160 + y, 30); PRINT("[]", w - w / 8 - 60, 125 + y, 30); - PRINT("|", w - w / 8 + 30, 125 + y, 30); + PRINT("O", w - w / 8 + 30, 125 + y, 30); #undef PRINT #undef CRECT } diff --git a/src/renderer/SpecialFX.cpp b/src/renderer/SpecialFX.cpp index 4f4e4a0..485a404 100644 --- a/src/renderer/SpecialFX.cpp +++ b/src/renderer/SpecialFX.cpp @@ -138,7 +138,7 @@ CSpecialFX::Render(void) { PUSH_RENDERGROUP("CSpecialFX::Render"); // CMotionBlurStreaks::Render(); - CBulletTraces::Render(); +// CBulletTraces::Render(); // CBrightLights::Render(); // CShinyTexts::Render(); CMoneyMessages::Render(); diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index 3c9588e..3cf05b7 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -71,8 +71,6 @@ const TUid KUidRE3 = {0xe0d67647}; #define JOY_L2 6 #define JOY_R2 7 #define JOY_BACK 8 -#define JOY_L3 9 -#define JOY_R3 10 #define JOY_START 11 #define JOY_DPAD_UP 12 #define JOY_DPAD_RIGHT 13 @@ -336,9 +334,6 @@ static int MapScanCode(TInt aScanCode, TInt aModifiers) { case 'z': case 'Z': case '1': - case EStdKeyDevice3: - case EStdKeyEnter: - case EStdKeyNkpEnter: return JOY_B; case 'x': case 'X': @@ -351,7 +346,6 @@ static int MapScanCode(TInt aScanCode, TInt aModifiers) { case 's': case 'S': case '3': - case EStdKeyBackspace: return JOY_Y; case '5': @@ -362,10 +356,6 @@ static int MapScanCode(TInt aScanCode, TInt aModifiers) { return JOY_L2; case '8': return JOY_R2; - case '9': - return JOY_L3; - case '0': - return JOY_R3; case EStdKeyDevice0: return JOY_BACK; @@ -420,6 +410,7 @@ public: CMenuManager::m_bStartUpFrontEndRequested = true; container->gGameState = GS_FRONTEND; +// container->gGameState = GS_INIT_PLAYING_GAME; break; case GS_FRONTEND: if (!ForegroundApp) break; @@ -445,9 +436,10 @@ public: TRACE("gGameState = GS_PLAYING_GAME;"); break; case GS_PLAYING_GAME: -// float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); - if (RwInitialised && ForegroundApp) { -// if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) + if (!ForegroundApp) break; + float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); + if ( RwInitialised ) { + if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); } break; @@ -515,13 +507,13 @@ public: SetFocus(ETrue); -#ifndef S60V3 +#ifdef RW_GL3 Window().EnableAdvancedPointers(); #endif EnableDragEvents(); ActivateL(); -#ifndef S60V3 +#ifdef RW_GL3 // VC4 check VersionInfo::TPlatformVersion platformVersion; VersionInfo::GetVersion(platformVersion); @@ -618,13 +610,12 @@ public: } virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent) { - touch = true; int x = aPointerEvent.iPosition.iX; int y = aPointerEvent.iPosition.iY; int w = Size().iWidth; int h = Size().iHeight; - if (h > 360) y = (y * 360) / 480; + if (h > 360) y += h - 360; // if (FrontEndMenuManager.m_bMenuActive) { // PSGLOBAL(lastMousePos).x = x; @@ -640,7 +631,7 @@ public: // CCoeControl::HandlePointerEventL(aPointerEvent); // return; // } -#ifndef S60V3 +#ifdef RW_GL3 const TAdvancedPointerEvent* advpointer = aPointerEvent.AdvancedPointerEvent(); int i = advpointer != NULL ? advpointer->PointerNumber() : 0; #else @@ -685,7 +676,7 @@ public: stickCenterX[i] = x; stickCenterY[i] = y; } - } else if (y > 280 && y < 280 + 32) { + } else if (y >= 280 && y <= 280 + 32) { if (x > 320 - 80 && x < 320 - 20) { // select activeZone[i] = JOY_BACK + 1; @@ -695,14 +686,6 @@ public: activeZone[i] = JOY_START + 1; virtualButtons[JOY_START] = 1; } - } else if (y > 280 - 32 && y < 280) { - if (x > 320 - 80 && x < 320 - 20) { - activeZone[i] = JOY_L3 + 1; - virtualButtons[JOY_L3] = 1; - } else if (x > 320 + 20 && x < 320 + 80) { - activeZone[i] = JOY_R3 + 1; - virtualButtons[JOY_R3] = 1; - } } else if (y >= 80 && y <= 80 + 120) { if (x < w / 4) { // dpad @@ -780,7 +763,6 @@ public: case EEventKeyUp: { TInt k = MapScanCode(aEvent.Key()->iScanCode, aEvent.Key()->iModifiers); if (k == -1) break; - touch = false; virtualButtons[k] = aEvent.Type() == EEventKeyDown; break; } @@ -788,14 +770,6 @@ public: break; } } - - void HandleResourceChange(TInt aType) { - switch (aType) { - case KEikDynamicLayoutVariantSwitch: - SetExtentToWholeScreen(); - break; - } - } }; class RE3AppUi : public CAknAppUi { diff --git a/vendor/librw/src/base.cpp b/vendor/librw/src/base.cpp index 02457c4..e3b78a0 100644 --- a/vendor/librw/src/base.cpp +++ b/vendor/librw/src/base.cpp @@ -137,9 +137,6 @@ slerp(const Quat &q, const Quat &p, float32 a) c = -c; q1 = negate(q1); } - if(c > 1.0f) { - c = 1.0f; - } float32 phi = acosf(c); if(phi > 0.00001f){ float32 s = sinf(phi); @@ -550,7 +547,7 @@ Matrix::invertGeneral(Matrix *dst, const Matrix *src) // get the determinant from that det = src->up.x * dst->right.y + src->at.x * dst->right.z + dst->right.x * src->right.x; invdet = 1.0; - if(fabsf(det) > 0.00001f) + if(det != 0.0f) invdet = 1.0f/det; dst->right.x *= invdet; dst->right.y *= invdet; @@ -573,7 +570,7 @@ Matrix::makeRotation(Matrix *dst, const V3d *axis, float32 angle) { // V3d v = normalize(*axis); float32 len = dot(*axis, *axis); - if(len > 0.00001f) len = 1.0f/sqrtf(len); + if(len != 0.0f) len = 1.0f/sqrtf(len); V3d v = rw::scale(*axis, len); angle = angle*(float)M_PI/180.0f; float32 s = sinf(angle); diff --git a/vendor/librw/src/gl/gl3immed.cpp b/vendor/librw/src/gl/gl3immed.cpp index 1619f23..a4b7474 100644 --- a/vendor/librw/src/gl/gl3immed.cpp +++ b/vendor/librw/src/gl/gl3immed.cpp @@ -113,10 +113,18 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices) glVertexAttribPointer(ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + 0); glEnableVertexAttribArray(ATTRIB_COLOR); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, r)); + #else + glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, r)); + #endif glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, u)); + #else + glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, u)); + #endif glDrawArrays(primTypeMap[primType], 0, numVertices); @@ -146,10 +154,18 @@ im2DRenderIndexedPrimitive(PrimitiveType primType, glVertexAttribPointer(ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + 0); glEnableVertexAttribArray(ATTRIB_COLOR); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, r)); + #else + glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, r)); + #endif glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, u)); + #else + glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, u)); + #endif glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); @@ -216,10 +232,18 @@ im3DRenderPrimitive(PrimitiveType primType) glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + 0); glEnableVertexAttribArray(ATTRIB_COLOR); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r)); + #else + glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, r)); + #endif glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u)); + #else + glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, u)); + #endif glDrawArrays(primTypeMap[primType], 0, num3DVertices); @@ -240,10 +264,18 @@ im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndic glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + 0); glEnableVertexAttribArray(ATTRIB_COLOR); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r)); + #else + glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, r)); + #endif glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); + #ifdef __SYMBIAN32__ glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u)); + #else + glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, u)); + #endif glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); diff --git a/vendor/librw/src/gles1/gl1immed.cpp b/vendor/librw/src/gles1/gl1immed.cpp index b071e1b..d9f7260 100644 --- a/vendor/librw/src/gles1/gl1immed.cpp +++ b/vendor/librw/src/gles1/gl1immed.cpp @@ -17,6 +17,8 @@ namespace rw { namespace gles1 { +uint32 im2DVbo, im2DIbo; + static int primTypeMap[] = { GL_POINTS, // invalid GL_LINES, @@ -30,11 +32,15 @@ static int primTypeMap[] = { void openIm2D(void) { + glGenBuffers(1, &im2DIbo); + glGenBuffers(1, &im2DVbo); } void closeIm2D(void) { + glDeleteBuffers(1, &im2DIbo); + glDeleteBuffers(1, &im2DVbo); } static Im2DVertex tmpprimbuf[3]; @@ -64,16 +70,15 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices) Camera *cam; cam = (Camera*)engine->currentCamera; - glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, im2DVbo); + glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im2DVertex), vertices, GL_DYNAMIC_DRAW); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), vertices); - + glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), (void*)0); glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, r))); - + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, r)); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, u))); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, u)); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -105,17 +110,18 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, Camera *cam; cam = (Camera*)engine->currentCamera; - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im2DIbo); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices*2, indices, GL_DYNAMIC_DRAW); + + glBindBuffer(GL_ARRAY_BUFFER, im2DVbo); + glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im2DVertex), vertices, GL_DYNAMIC_DRAW); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), vertices); - + glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), (void*)0); glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, r))); - + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, r)); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, u))); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, u)); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -127,7 +133,7 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, glLoadIdentity(); flushCache(); - glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, nil); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -141,17 +147,30 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, // Im3D -static int32 num3DVertices; +static AttribDesc im3dattribDesc[3] = { + { ATTRIB_POS, GL_FLOAT, GL_FALSE, 3, + sizeof(Im3DVertex), 0 }, + { ATTRIB_COLOR, GL_UNSIGNED_BYTE, GL_TRUE, 4, + sizeof(Im3DVertex), OFFSET_OF(Im3DVertex, r) }, + { ATTRIB_TEXCOORDS0, GL_FLOAT, GL_FALSE, 2, + sizeof(Im3DVertex), OFFSET_OF(Im3DVertex, u) }, +}; +static uint32 im3DVbo, im3DIbo; +static int32 num3DVertices; // not actually needed here static void* currentIm3dVertices; void openIm3D(void) { + glGenBuffers(1, &im3DIbo); + glGenBuffers(1, &im3DVbo); } void closeIm3D(void) { + glDeleteBuffers(1, &im3DIbo); + glDeleteBuffers(1, &im3DVbo); } void @@ -167,23 +186,21 @@ im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) if((flags & im3d::VERTEXUV) == 0) SetRenderStatePtr(TEXTURERASTER, nil); - currentIm3dVertices = vertices; + glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); + glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im3DVertex), vertices, GL_DYNAMIC_DRAW); num3DVertices = numVertices; } void im3DRenderPrimitive(PrimitiveType primType) { - glBindBuffer(GL_ARRAY_BUFFER, 0); - + glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), currentIm3dVertices); - + glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), (void*)0); glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r))); - + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, r)); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u))); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, u)); flushCache(); glDrawArrays(primTypeMap[primType], 0, num3DVertices); @@ -196,20 +213,19 @@ im3DRenderPrimitive(PrimitiveType primType) void im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices) { - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im3DIbo); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices*2, indices, GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), currentIm3dVertices); - + glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), (void*)0); glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r))); - + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, r)); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u))); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, u)); flushCache(); - glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, nil); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); diff --git a/vendor/librw/src/gles1/gl1skin.cpp b/vendor/librw/src/gles1/gl1skin.cpp index a4c3849..901923d 100644 --- a/vendor/librw/src/gles1/gl1skin.cpp +++ b/vendor/librw/src/gles1/gl1skin.cpp @@ -33,10 +33,6 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header) InstanceData *inst = header->inst; int32 n = header->numMeshes; - //test rapido a ver si es la textura - glDisableClientState(GL_COLOR_ARRAY); - glColor4f(1,1,1,1); - while(n--){ m = inst->material; setMaterial(flags, m->color, m->surfaceProps); @@ -51,7 +47,6 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header) // skinInstanceCB: igual que defaultInstanceCB, sin pesos/indices // porque GLES1 no puede hacer skinning en GPU -// aunque... capaz podemos hacerloc on el PowerVR y las extensiones void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance) { diff --git a/vendor/librw/src/rwbase.h b/vendor/librw/src/rwbase.h index fca8bed..87a6f33 100644 --- a/vendor/librw/src/rwbase.h +++ b/vendor/librw/src/rwbase.h @@ -11,12 +11,14 @@ #ifdef __SYMBIAN32__ #undef stderr #define stderr stdout -#endif #ifdef OFFSET_OF #undef OFFSET_OF #endif -#define OFFSET_OF(type, member) ((size_t)&(((type*)0)->member)) + +#define OFFSET_OF(type, member) \ + ((size_t)((char*)&(((type*)0)->member) - (char*)0)) +#endif // TODO: clean up the opengl defines // and figure out what we even want here... @@ -560,7 +562,7 @@ enum Platform PLATFORM_WDGL = 11, // WarDrum OpenGL PLATFORM_GL3 = 12, // my GL3 implementation - PLATFORM_GLES1 = 14, + PLATFORM_GLES1 = 13, NUM_PLATFORMS,