diff --git a/TODO.md b/TODO.md index 04a9111..4de6e4f 100644 --- a/TODO.md +++ b/TODO.md @@ -11,6 +11,7 @@ Common: - [ ] Menu - [ ] Config - [x] Merge S60v3 and ^3 branches +- [ ] Move map to top left corner GLES 2.0 specific: - [x] Optimize to always run 10+ fps diff --git a/group/common.mmh b/group/common.mmh index e11df51..59915c0 100644 --- a/group/common.mmh +++ b/group/common.mmh @@ -27,6 +27,7 @@ ALWAYS_BUILD_AS_ARM SYSTEMINCLUDE /epoc32/include/stdapis/stlportv5 STDCPP MACRO RW_GL3 +MACRO RW_OPENGL // because carbide is too stupid #else SYSTEMINCLUDE /epoc32/include/stdapis/stlport SYSTEMINCLUDE /epoc32/include/stdapis/stlport/stl diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index e911ea0..03b399d 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -16,7 +16,7 @@ #include "Renderer.h" #if defined __ARMCC_VERSION && !defined _DEBUG -#pragma O2 +#pragma O2 // fixes crash #endif int32 CCullZones::NumCullZones; diff --git a/src/core/main.cpp b/src/core/main.cpp index 9a04577..4e8b181 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1758,9 +1758,7 @@ Idle(void *arg) if (gbShowTimebars) tbDisplay(); - tbStartTimer(0, "EndOfFrame"); DoRWStuffEndOfFrame(); - tbEndTimer("EndOfFrame"); POP_MEMID(); // MEMID_RENDER diff --git a/src/math/math.cpp b/src/math/math.cpp index 57d6f82..8cb56da 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -80,8 +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--){ - const RwV3d i = *in; - *out = mat * i; + *out = mat * *in; in = (RwV3d*)((uint8*)in + stride); out++; } @@ -111,8 +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--){ - const RwV3d i = *in; - *out = mat * i; + *out = mat * *in; in++; out++; } diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index 78a839b..b9db7c2 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -57,6 +57,9 @@ static EGLConfig eglConfig; rw::EngineOpenParams openParams; +static RwBool ForegroundApp = TRUE; +static RwBool RwInitialised = FALSE; + const TUid KUidRE3 = {0xe0d67647}; #define JOY_A 0 // cross @@ -85,8 +88,6 @@ static uint32 cyclesPerMS; static psGlobalType PsGlobal; -static TBool foreground; - static bool spinning; bool qwerty; @@ -101,7 +102,7 @@ const char* _psGetUserFilesFolder() { } void HandleExit() { - if (IsForegroundApp()) { + if (ForegroundApp) { User::ResetInactivityTime(); } RThread thread; @@ -124,9 +125,36 @@ RwChar** _psGetVideoModeList() { return modes; } +void psPostRWinit(void) +{ + CPad::GetPad(0)->Clear(true); + CPad::GetPad(1)->Clear(true); +} + void _psSelectScreenVM(RwInt32 videoMode) { RwTexDictionarySetCurrent( nil ); FrontEndMenuManager.UnloadTextures(); + + RwInitialised = FALSE; + + RsEventHandler(rsRWTERMINATE, nil); + + if ( RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR ) + return; + + RwInitialised = TRUE; + + RwRect r; + + r.x = 0; + r.y = 0; + r.w = RsGlobal.maximumWidth; + r.h = RsGlobal.maximumHeight; + + RsEventHandler(rsCAMERASIZE, &r); + + psPostRWinit(); + FrontEndMenuManager.LoadAllTextures(); } @@ -252,7 +280,7 @@ uint32 CTimer::GetCyclesPerMillisecond(void) { } RwBool IsForegroundApp() { - return foreground; + return ForegroundApp; } static int MapScanCode(TInt aScanCode, TInt aModifiers) { @@ -354,10 +382,10 @@ public: } if (spinning) return ETrue; + RwInitialised = TRUE; switch (container->gGameState) { case GS_START_UP: - foreground = true; if (HAL::Get(HAL::ENanoTickPeriod, tickPeriod) != KErrNone) { User::Panic(_L("Could not init timer"), 0); } @@ -371,8 +399,8 @@ public: RsGlobal.quit = TRUE; return ETrue; } -// container->gGameState = GS_INIT_FRONTEND; - container->gGameState = GS_INIT_PLAYING_GAME; + container->gGameState = GS_INIT_FRONTEND; +// container->gGameState = GS_INIT_PLAYING_GAME; break; case GS_INIT_FRONTEND: LoadingScreen(nil, nil, "loadsc0"); @@ -382,11 +410,10 @@ public: CMenuManager::m_bStartUpFrontEndRequested = true; container->gGameState = GS_FRONTEND; - // container->gGameState = GS_INIT_PLAYING_GAME; break; case GS_FRONTEND: - if (!IsForegroundApp()) break; + if (!ForegroundApp) break; RsEventHandler(rsFRONTENDIDLE, nil); if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad ) { @@ -409,17 +436,52 @@ public: TRACE("gGameState = GS_PLAYING_GAME;"); break; case GS_PLAYING_GAME: - if (!IsForegroundApp()) break; + if (!ForegroundApp) break; float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); -// if ( RwInitialised ) -// { + if ( RwInitialised ) { if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); -// } + } break; } - if (IsForegroundApp()) { + if (FrontEndMenuManager.m_bWantToRestart) { + RwInitialised = FALSE; + FrontEndMenuManager.UnloadTextures(); + CPad::ResetCheats(); + CPad::StopPadsShaking(); + DMAudio.ChangeMusicMode(MUSICMODE_DISABLE); + CTimer::Stop(); + if ( FrontEndMenuManager.m_bWantToLoad ) + { + CGame::ShutDownForRestart(); + CGame::InitialiseWhenRestarting(); + DMAudio.ChangeMusicMode(MUSICMODE_GAME); + LoadSplash(GetLevelSplashScreen(CGame::currLevel)); + FrontEndMenuManager.m_bWantToLoad = false; + } else { + if ( container->gGameState == GS_PLAYING_GAME ) + CGame::ShutDown(); + + CTimer::Stop(); + + if ( FrontEndMenuManager.m_bFirstTime == true ) + { + container->gGameState = GS_INIT_FRONTEND; + TRACE("gGameState = GS_INIT_FRONTEND;"); + } + else + { + container->gGameState = GS_INIT_PLAYING_GAME; + TRACE("gGameState = GS_INIT_PLAYING_GAME;"); + } + } + + FrontEndMenuManager.m_bFirstTime = false; + FrontEndMenuManager.m_bWantToRestart = false; + } + + if (ForegroundApp) { User::ResetInactivityTime(); } @@ -463,7 +525,7 @@ public: RsGlobal.height = size.iHeight; EGLint attribs[] = { - EGL_BUFFER_SIZE, 24, + EGL_BUFFER_SIZE, 16, EGL_DEPTH_SIZE, 16, EGL_STENCIL_SIZE, 0, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, @@ -521,10 +583,11 @@ public: ControlsManager.MakeControllerActionsBlank(); ControlsManager.InitDefaultControlConfiguration(); + RwInitialised = FALSE; if(RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR) return; - - CPad::GetPad(0)->Clear(true); - CPad::GetPad(1)->Clear(true); + + RwInitialised = TRUE; + psPostRWinit(); PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f; RsGlobal.ps = &PsGlobal; @@ -694,7 +757,7 @@ public: } void HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination) { - if (!IsForegroundApp() || iAppUi->IsDisplayingDialog()) return; + if (!ForegroundApp || iAppUi->IsDisplayingDialog()) return; switch (aEvent.Type()) { case EEventKeyDown: case EEventKeyUp: { @@ -720,7 +783,7 @@ public: AddToStackL(iContainer); } void HandleForegroundEventL(TBool aForeground) { - foreground = aForeground; + ForegroundApp = aForeground; } ~RE3AppUi() { diff --git a/vendor/librw/src/gl/gl3raster.cpp b/vendor/librw/src/gl/gl3raster.cpp index 54d400f..1a1e044 100644 --- a/vendor/librw/src/gl/gl3raster.cpp +++ b/vendor/librw/src/gl/gl3raster.cpp @@ -139,10 +139,10 @@ rasterCreateTexture(Raster *raster) glGenTextures(1, &natras->texid); uint32 prev = bindTexture(natras->texid); - glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat, -// raster->width, raster->height, - 1,1, - 0, natras->format, natras->type, nil); +// glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat, +//// raster->width, raster->height, +// 1,1, +// 0, natras->format, natras->type, nil); // TODO: allocate other levels...probably #ifndef __SYMBIAN32__ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, natras->numLevels-1);