diff --git a/TODO.md b/TODO.md index 26cc810..698f30f 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,15 +19,20 @@ 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 -- [ ] Keyboard mappings for both QWERTY/12-keys +- [x] 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 bcb0a2f..93771b3 100644 --- a/group/bld.inf +++ b/group/bld.inf @@ -2,6 +2,7 @@ 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 3c7bbaf..e04e11c 100644 --- a/group/common.mmh +++ b/group/common.mmh @@ -17,8 +17,9 @@ SRCDBG OPTION ARMCC --gnu -Otime --diag_suppress 1,68,111,174,381,1293 OPTION_REPLACE ARMCC --cpu 6 -OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast -OPTION_REPLACE ARMCC -O2 -O3 // too dangerous! +OPTION_REPLACE ARMCC --fpu vfpv2 --fpmode fast +// too dangerous! +OPTION_REPLACE ARMCC -O2 -O3 #ifdef ARMCC ALWAYS_BUILD_AS_ARM #endif @@ -27,10 +28,10 @@ ALWAYS_BUILD_AS_ARM SYSTEMINCLUDE /epoc32/include/stdapis/stlportv5 STDCPP MACRO RW_GL3 -MACRO RW_OPENGL // because carbide is too stupid +MACRO RW_OPENGL #else SYSTEMINCLUDE /epoc32/include/stdapis/stlport SYSTEMINCLUDE /epoc32/include/stdapis/stlport/stl MACRO RW_GLES1 -MACRO S60V5 +MACRO S60V3 #endif diff --git a/group/librw_gles1.mmp b/group/librw_gles1.mmp index 0ed82e4..4d2e805 100644 --- a/group/librw_gles1.mmp +++ b/group/librw_gles1.mmp @@ -1,4 +1,3 @@ #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 b161ff5..d33a32e 100644 --- a/group/librw_gles2.mmp +++ b/group/librw_gles2.mmp @@ -1,4 +1,3 @@ -#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 79ed835..bade9b7 100644 --- a/group/re3_gles1.mmp +++ b/group/re3_gles1.mmp @@ -1,5 +1,4 @@ #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 b440269..5d2a0d0 100644 --- a/group/re3_gles2.mmp +++ b/group/re3_gles2.mmp @@ -1,4 +1,3 @@ -#undef S60V3 #define SYMBIAN_3 TARGET re3.exe LIBRARY libstdcppv5.lib @@ -6,5 +5,6 @@ LIBRARY libglesv2.lib LIBRARY libegl.lib LIBRARY platformver.lib STATICLIBRARY librw_gles2.lib -ARMFPU softvfp+vfpv2 +ARMFPU vfpv2 +SMPSAFE #include "re3.mmh" \ No newline at end of file diff --git a/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index b76f1c5..b20c89d 100644 --- a/sis/re3-gles1.pkg +++ b/sis/re3-gles1.pkg @@ -1,22 +1,26 @@ -#{"GTA III"},(0xe0d67647),1,0,0 +#{"GTA III"},(0xe0d67647),1,0,1 -[0x101F7961], 0, 0, 0, {"S60ProductID"} -[0x1028315F], 0, 0, 0, {"S60ProductID"} -[0x20022E6D], 0, 0, 0, {"S60ProductID"} +[0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 +[0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 +[0x20022E6D], 0, 0, 0, {"S60ProductID"} ; ^3 %{"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" \ No newline at end of file +"$(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/sis/re3.pkg b/sis/re3.pkg index 1c9097c..84887fd 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,8 +1,8 @@ -#{"GTA III"},(0xe0d67647),1,0,0 +#{"GTA III"},(0xe0d67647),1,0,1 -[0x101F7961], 0, 0, 0, {"S60ProductID"} -[0x1028315F], 0, 0, 0, {"S60ProductID"} -[0x20022E6D], 0, 0, 0, {"S60ProductID"} +[0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 +[0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 +[0x20022E6D], 0, 0, 0, {"S60ProductID"} ; ^3 %{"nnproject"} :"nnproject" @@ -11,12 +11,24 @@ 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") +IF exists("z:\system\install\Series60v5.2.sis") AND exists("z:\sys\bin\libGLESv2.dll") ; ^3 "$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3.exe"-"!:\sys\bin\re3.exe" -ELSE +ELSE ; everything 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 8faa6c2..e27ebcf 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3689,6 +3689,7 @@ const char* controllerTypesPaths[] = { void CMenuManager::LoadController(int8 type) { +#ifdef BUTTON_ICONS switch (type) { case CONTROLLER_DUALSHOCK2: @@ -3703,7 +3704,8 @@ 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(); @@ -5140,6 +5142,9 @@ 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; @@ -5147,8 +5152,6 @@ 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; @@ -5157,6 +5160,7 @@ 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 03b399d..56192ea 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -16,7 +16,8 @@ #include "Renderer.h" #if defined __ARMCC_VERSION && !defined _DEBUG -#pragma O2 // fixes crash +// fixes crash +#pragma O2 #endif int32 CCullZones::NumCullZones; diff --git a/src/core/config.h b/src/core/config.h index b7baed8..56a689e 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 87484ee..d44fe99 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1448,17 +1448,21 @@ RenderEffects(void) CGlass::Render(); CWaterCannons::Render(); CSpecialFX::Render(); -// CShadows::RenderStaticShadows(); -// CShadows::RenderStoredShadows(); -// CSkidmarks::Render(); -// CAntennas::Render(); -// CRubbish::Render(); -// CCoronas::Render(); + #ifdef RW_GLES1 + CShadows::RenderStaticShadows(); + CShadows::RenderStoredShadows(); + CSkidmarks::Render(); + CAntennas::Render(); + CRubbish::Render(); + CCoronas::Render(); + #endif CParticle::Render(); CPacManPickups::Render(); -// CWeaponEffects::Render(); -// CPointLights::RenderFogEffect(); -// CMovingThings::Render(); + #ifdef RW_GLES1 + CWeaponEffects::Render(); + CPointLights::RenderFogEffect(); + CMovingThings::Render(); + #endif CRenderer::RenderFirstPersonVehicle(); POP_RENDERGROUP(); } diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp index c0621f8..8f01fe0 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -84,9 +84,6 @@ 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 8cb56da..ff86039 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -80,7 +80,12 @@ 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++; } @@ -110,7 +115,12 @@ 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 4876f79..e44a208 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1,5 +1,6 @@ #if defined __ARMCC_VERSION && !defined _DEBUG -#pragma O2 // fixes crash +// fixes crash +#pragma O2 #endif #include "common.h" diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index dacec8b..7b9e0dd 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -1355,19 +1355,25 @@ 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("O", w - w / 8 + 30, 125 + y, 30); + PRINT("|", w - w / 8 + 30, 125 + y, 30); #undef PRINT #undef CRECT } diff --git a/src/renderer/SpecialFX.cpp b/src/renderer/SpecialFX.cpp index 485a404..4f4e4a0 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 3cf05b7..3c9588e 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -71,6 +71,8 @@ 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 @@ -334,6 +336,9 @@ 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': @@ -346,6 +351,7 @@ static int MapScanCode(TInt aScanCode, TInt aModifiers) { case 's': case 'S': case '3': + case EStdKeyBackspace: return JOY_Y; case '5': @@ -356,6 +362,10 @@ 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; @@ -410,7 +420,6 @@ public: CMenuManager::m_bStartUpFrontEndRequested = true; container->gGameState = GS_FRONTEND; -// container->gGameState = GS_INIT_PLAYING_GAME; break; case GS_FRONTEND: if (!ForegroundApp) break; @@ -436,10 +445,9 @@ public: TRACE("gGameState = GS_PLAYING_GAME;"); break; case GS_PLAYING_GAME: - if (!ForegroundApp) break; - float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); - if ( RwInitialised ) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) +// float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); + if (RwInitialised && ForegroundApp) { +// if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); } break; @@ -507,13 +515,13 @@ public: SetFocus(ETrue); -#ifdef RW_GL3 +#ifndef S60V3 Window().EnableAdvancedPointers(); #endif EnableDragEvents(); ActivateL(); -#ifdef RW_GL3 +#ifndef S60V3 // VC4 check VersionInfo::TPlatformVersion platformVersion; VersionInfo::GetVersion(platformVersion); @@ -610,12 +618,13 @@ 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 += h - 360; + if (h > 360) y = (y * 360) / 480; // if (FrontEndMenuManager.m_bMenuActive) { // PSGLOBAL(lastMousePos).x = x; @@ -631,7 +640,7 @@ public: // CCoeControl::HandlePointerEventL(aPointerEvent); // return; // } -#ifdef RW_GL3 +#ifndef S60V3 const TAdvancedPointerEvent* advpointer = aPointerEvent.AdvancedPointerEvent(); int i = advpointer != NULL ? advpointer->PointerNumber() : 0; #else @@ -676,7 +685,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; @@ -686,6 +695,14 @@ 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 @@ -763,6 +780,7 @@ public: case EEventKeyUp: { TInt k = MapScanCode(aEvent.Key()->iScanCode, aEvent.Key()->iModifiers); if (k == -1) break; + touch = false; virtualButtons[k] = aEvent.Type() == EEventKeyDown; break; } @@ -770,6 +788,14 @@ 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 e3b78a0..02457c4 100644 --- a/vendor/librw/src/base.cpp +++ b/vendor/librw/src/base.cpp @@ -137,6 +137,9 @@ 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); @@ -547,7 +550,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(det != 0.0f) + if(fabsf(det) > 0.00001f) invdet = 1.0f/det; dst->right.x *= invdet; dst->right.y *= invdet; @@ -570,7 +573,7 @@ Matrix::makeRotation(Matrix *dst, const V3d *axis, float32 angle) { // V3d v = normalize(*axis); float32 len = dot(*axis, *axis); - if(len != 0.0f) len = 1.0f/sqrtf(len); + if(len > 0.00001f) 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 a4b7474..1619f23 100644 --- a/vendor/librw/src/gl/gl3immed.cpp +++ b/vendor/librw/src/gl/gl3immed.cpp @@ -113,18 +113,10 @@ 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); @@ -154,18 +146,10 @@ 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); @@ -232,18 +216,10 @@ 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); @@ -264,18 +240,10 @@ 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 d9f7260..b071e1b 100644 --- a/vendor/librw/src/gles1/gl1immed.cpp +++ b/vendor/librw/src/gles1/gl1immed.cpp @@ -17,8 +17,6 @@ namespace rw { namespace gles1 { -uint32 im2DVbo, im2DIbo; - static int primTypeMap[] = { GL_POINTS, // invalid GL_LINES, @@ -32,15 +30,11 @@ 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]; @@ -70,15 +64,16 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices) Camera *cam; cam = (Camera*)engine->currentCamera; - glBindBuffer(GL_ARRAY_BUFFER, im2DVbo); - glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im2DVertex), vertices, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), (void*)0); + glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), vertices); + glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, r)); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, r))); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, u)); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, u))); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -110,18 +105,17 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, Camera *cam; cam = (Camera*)engine->currentCamera; - 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); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), (void*)0); + glVertexPointer(3, GL_FLOAT, sizeof(Im2DVertex), vertices); + glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, r)); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, r))); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)OFFSET_OF(Im2DVertex, u)); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im2DVertex), (void*)((uint8*)vertices + OFFSET_OF(Im2DVertex, u))); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -133,7 +127,7 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, glLoadIdentity(); flushCache(); - glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, nil); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -147,30 +141,17 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, // Im3D -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 int32 num3DVertices; static void* currentIm3dVertices; void openIm3D(void) { - glGenBuffers(1, &im3DIbo); - glGenBuffers(1, &im3DVbo); } void closeIm3D(void) { - glDeleteBuffers(1, &im3DIbo); - glDeleteBuffers(1, &im3DVbo); } void @@ -186,21 +167,23 @@ im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) if((flags & im3d::VERTEXUV) == 0) SetRenderStatePtr(TEXTURERASTER, nil); - glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); - glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im3DVertex), vertices, GL_DYNAMIC_DRAW); + currentIm3dVertices = vertices; num3DVertices = numVertices; } void im3DRenderPrimitive(PrimitiveType primType) { - glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), (void*)0); + glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), currentIm3dVertices); + glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, r)); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r))); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, u)); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u))); flushCache(); glDrawArrays(primTypeMap[primType], 0, num3DVertices); @@ -213,19 +196,20 @@ im3DRenderPrimitive(PrimitiveType primType) void im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices) { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im3DIbo); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices*2, indices, GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), (void*)0); + glVertexPointer(3, GL_FLOAT, sizeof(Im3DVertex), currentIm3dVertices); + glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, r)); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, r))); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)OFFSET_OF(Im3DVertex, u)); + glTexCoordPointer(2, GL_FLOAT, sizeof(Im3DVertex), (void*)((uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u))); flushCache(); - glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, nil); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); 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 901923d..a4c3849 100644 --- a/vendor/librw/src/gles1/gl1skin.cpp +++ b/vendor/librw/src/gles1/gl1skin.cpp @@ -33,6 +33,10 @@ 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); @@ -47,6 +51,7 @@ 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 87a6f33..fca8bed 100644 --- a/vendor/librw/src/rwbase.h +++ b/vendor/librw/src/rwbase.h @@ -11,14 +11,12 @@ #ifdef __SYMBIAN32__ #undef stderr #define stderr stdout +#endif #ifdef OFFSET_OF #undef OFFSET_OF #endif - -#define OFFSET_OF(type, member) \ - ((size_t)((char*)&(((type*)0)->member) - (char*)0)) -#endif +#define OFFSET_OF(type, member) ((size_t)&(((type*)0)->member)) // TODO: clean up the opengl defines // and figure out what we even want here... @@ -562,7 +560,7 @@ enum Platform PLATFORM_WDGL = 11, // WarDrum OpenGL PLATFORM_GL3 = 12, // my GL3 implementation - PLATFORM_GLES1 = 13, + PLATFORM_GLES1 = 14, NUM_PLATFORMS,