From 36a414e12a0ea2974b756d62098c29ef8d2a2794 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 2 Oct 2017 13:48:06 +0000 Subject: [PATCH] * (Windows) Running "dink.exe c:\temp\ACoolDMOD.dmod" from the command line will now install it, then run it. (original dmod file won't be deleted) Just seemed weird that this didn't exist so added it * DMOD installer progress now switches to showing MB instead of K if the size is big * BUGFIX: Fixed map loading bug that could crash the game (I added this one recently trying to clean up code to use more consts rather than magic #s, but there is always the risk I stupidely break something!) * load_tile no longer instantly takes effect but requires a draw_screen or moving screens, this matches how 1.08 worked. Loading a save state or resizing the window will cause it to happen early, but hey, close enough * BUGFIX: Fixed extra nasty bug where logic on certain things like charging your magic would pause the amount of time you used TAB to skip time git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1517 353e56fe-9613-0410-8469-b96ad8e6f29c --- Info.plist | 2 +- OSX/Info.plist | 4 +- android/AndroidManifest.xml | 2 +- script/win_installer/readme.txt | 10 +++++ source/App.cpp | 8 ++-- source/App.h | 3 ++ source/Component/InventoryComponent.cpp | 1 + source/GUI/DMODInstallMenu.cpp | 24 ++++++++--- source/GUI/DMODInstallMenu.h | 2 +- source/GUI/MainMenu.cpp | 34 ++++++++++++--- source/dink/dink.cpp | 56 +++++++++++-------------- windows_vs2017/winRTDink.vcxproj.user | 2 +- 12 files changed, 96 insertions(+), 52 deletions(-) diff --git a/Info.plist b/Info.plist index 7fe6701..8f3ffb5 100644 --- a/Info.plist +++ b/Info.plist @@ -25,7 +25,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.8.5 + 1.8.2 CFBundleSignature ???? CFBundleVersion diff --git a/OSX/Info.plist b/OSX/Info.plist index 724ec2c..239f5c3 100644 --- a/OSX/Info.plist +++ b/OSX/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.8.5 + 1.8.6 CFBundleSignature ???? CFBundleVersion - 1.8.5 + 1.8.6 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 1eec5f6..30171da 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,7 +2,7 @@ diff --git a/script/win_installer/readme.txt b/script/win_installer/readme.txt index 44a3bec..7972317 100644 --- a/script/win_installer/readme.txt +++ b/script/win_installer/readme.txt @@ -252,3 +252,13 @@ a specific speed, but by choosing rather snappy speed hopefully mystery island a ------ Change log for 1.8.5 ---------- * Tweaked speed a bit, sort of aligned it so the cutscenes in Initiation play right + +------ Change log for 1.8.6 ---------- + +* (Windows) Running "dink.exe c:\temp\ACoolDMOD.dmod" from the command line will now install it, then run it. (original dmod file won't be deleted) Just seemed weird that this didn't exist so added it +* DMOD installer progress now switches to showing MB instead of K if the size is big +* BUGFIX: Fixed map loading bug that could crash the game (I added this one recently trying to clean up code to use more consts rather than magic #s, but there is always the risk I stupidely break something!) +* load_tile no longer instantly takes effect but requires a draw_screen or moving screens, this matches how 1.08 worked. Loading a save state or resizing the window will cause it to happen early, but hey, close enough +* BUGFIX: Fixed extra nasty bug where logic on certain things like charging your magic would pause the amount of time you used TAB to skip time + +- Note: Just to be safe, save state version has changed, so old save states won't load diff --git a/source/App.cpp b/source/App.cpp index 9f8b505..c2a92f8 100644 --- a/source/App.cpp +++ b/source/App.cpp @@ -184,8 +184,8 @@ App::App() m_bDidPostInit = false; m_bHasDMODSupport = true; //for mobiles - m_version = 1.85f; - m_versionString = "V1.8.5"; + m_version = 1.86f; + m_versionString = "V1.8.6"; m_build = 1; m_bCheatsEnabled = false; @@ -282,7 +282,7 @@ bool App::Init() int scaleToX = 480; int scaleToY = 320; - if (IsTabletSize() || IsDesktop()) + //if (IsTabletSize() || IsDesktop()) { scaleToX = 1024; scaleToY = 768; @@ -694,7 +694,7 @@ void App::AddDroidKeyboardKeys() AddKeyBinding(pComp, "KeyboardAltMagic", 8, VIRTUAL_KEY_GAME_MAGIC); AddKeyBinding(pComp, "KeyboardInventory", 'I', VIRTUAL_KEY_GAME_INVENTORY); - AddKeyBinding(pComp, "KeyboardAltTalk", 13, VIRTUAL_KEY_GAME_TALK); + //AddKeyBinding(pComp, "KeyboardAltTalk", 13, VIRTUAL_KEY_GAME_TALK); //not sure what this was for, special android key? It caused ineventory to open AND dink to talk so was bad I think AddKeyBinding(pComp, "KeyboardFire", VIRTUAL_KEY_DIR_CENTER, VIRTUAL_KEY_GAME_FIRE); AddKeyBinding(pComp, "KeyboardFire2", 'X', VIRTUAL_KEY_GAME_FIRE); // AddKeyBinding(pComp, "KeyboardAltFire", VIRTUAL_KEY_SHIFT, VIRTUAL_KEY_GAME_FIRE); diff --git a/source/App.h b/source/App.h index 32a2cbb..4c400a1 100644 --- a/source/App.h +++ b/source/App.h @@ -92,6 +92,9 @@ public: bool GetGhostMode() {return m_bGhostMode;} void SetGhostMode(bool bNew) { m_bGhostMode = bNew; } bool UseClassicEscapeMenu(); + vector * GetReferenceToCommandLineParms() { return &m_commandLineParms; } + + private: AdManager m_adManager; diff --git a/source/Component/InventoryComponent.cpp b/source/Component/InventoryComponent.cpp index e332a8e..c14744f 100644 --- a/source/Component/InventoryComponent.cpp +++ b/source/Component/InventoryComponent.cpp @@ -36,6 +36,7 @@ void InventoryComponent::OnAdd(Entity *pEnt) void InventoryComponent::OnRemove() { EntityComponent::OnRemove(); + } void InventoryComponent::OnUpdatePos(CL_Vec2f vPos) diff --git a/source/GUI/DMODInstallMenu.cpp b/source/GUI/DMODInstallMenu.cpp index aefa939..82d8860 100644 --- a/source/GUI/DMODInstallMenu.cpp +++ b/source/GUI/DMODInstallMenu.cpp @@ -216,7 +216,14 @@ void OnDMODUnpackStatusUpdate(VariantList *pVList) float progress = float( (curBytes%barSize)) /float(barSize); //LogMsg("prog: %.2f", progress); - DMODInstallUpdateStatus(NULL, "Writing "+toString(curBytes/1024)+"K"); + int installSize = curBytes / 1024; + string sizeType = "K"; + if (installSize > 10000) + { + installSize /= 1024; + sizeType = "MB"; + } + DMODInstallUpdateStatus(NULL, "Writing "+toString(installSize)+ " "+sizeType); DMODInstallSetProgressBar(progress); } @@ -249,8 +256,9 @@ void OnDMODInstallHTTPFinish(VariantList *pVList) DMODSetTitleLabel(pMenu, string("Installing ")+pMenu->GetVar("originalFileName")->GetString()+"..."); EntityComponent *pUnpack = pMenu->AddComponent(new UnpackArchiveComponent); pUnpack->GetVar("sourceFileName")->Set(pMenu->GetVar("tempFileName")->GetString()); - - pUnpack->GetVar("deleteSourceOnFinish")->Set(uint32(1)); + bool bDeleteOnFinish = pMenu->GetVar("deleteOnFinish")->GetUINT32(); + + pUnpack->GetVar("deleteSourceOnFinish")->Set(uint32(bDeleteOnFinish)); pUnpack->GetVar("destDirectory")->Set(pMenu->GetVar("installDirectory")->GetString()); DMODInstallSetProgressBar(0); @@ -310,7 +318,7 @@ void InitNetStuff(VariantList *pVList) } -Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName, bool bFromBrowseMenu, string dmodName) +Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName, bool bFromBrowseMenu, string dmodName, bool bDeleteOnFinish) { Entity *pBG = CreateOverlayEntity(pParentEnt, "DMODInstall", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0); @@ -331,11 +339,12 @@ Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string instal pBG->GetVar("tempFileName")->Set(GetDMODRootPath()+"temp.dmod"); pBG->GetVar("originalFileName")->Set(GetFileNameFromString(dmodURL)); pBG->GetVar("fromBrowseMenu")->Set(uint32(bFromBrowseMenu)); - + pBG->GetVar("deleteOnFinish")->Set(uint32(bDeleteOnFinish)); if (IsLargeScreen()) { //SetupTextEntity(pTitleLabel, FONT_LARGE); } + //SetAlignmentEntity(pTitleLabel, ALIGNMENT_CENTER); EntityComponent *pTyper = pTitleLabel->AddComponent(new TyperComponent); @@ -370,6 +379,11 @@ Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string instal pBG->GetVar("exitto")->Set("browse"); } + if (!bDeleteOnFinish) + { + pBG->GetVar("autoplay")->Set(uint32(1)); + } + if (!sourceFileName.empty()) { diff --git a/source/GUI/DMODInstallMenu.h b/source/GUI/DMODInstallMenu.h index aaf7c2d..59aee19 100644 --- a/source/GUI/DMODInstallMenu.h +++ b/source/GUI/DMODInstallMenu.h @@ -3,5 +3,5 @@ #include "App.h" -Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName = "", bool bFromBrowseMenu = false, string dmodName = ""); +Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName = "", bool bFromBrowseMenu = false, string dmodName = "", bool bDeleteOnFinish = true); #endif // DMODInstallMenu_h__ \ No newline at end of file diff --git a/source/GUI/MainMenu.cpp b/source/GUI/MainMenu.cpp index 7df43a5..5598e63 100644 --- a/source/GUI/MainMenu.cpp +++ b/source/GUI/MainMenu.cpp @@ -209,10 +209,30 @@ void MainMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sen } -string GetNextDMODToInstall() +string GetNextDMODToInstall(bool &bIsCommandLineInstall, const bool bDeleteCommandLineParms) { //if (!GetApp()->CanDownloadDMODS()) return ""; //ignore it + if (IsDesktop()) + { + vector parms = GetApp()->GetCommandLineParms(); + + for (int i = 0; i < parms.size(); i++) + { + StringReplace("\"", "", parms[i]); + if (IsInString(ToLowerCaseString(parms[i]), ".dmod")) + { + bIsCommandLineInstall = true; + + //dmod sent via commandline, install it + if (bDeleteCommandLineParms) + GetApp()->GetReferenceToCommandLineParms()[i].clear(); //don't want to install the same dmod twice + return parms[i]; + } + } + } + + vector files = GetFilesAtPath(GetSavePath()); //LogMsg("listing files"); @@ -240,10 +260,13 @@ void MainOnStartLoading(VariantList *pVList) GetMessageManager()->CallEntityFunction(pBG, 500, "OnDelete", NULL); pBG->SetName("MainMenuDelete"); - string fName = GetNextDMODToInstall(); + bool bIsCommandLineInstall = true; + + string fName = GetNextDMODToInstall(bIsCommandLineInstall, true); + if (!fName.empty()) { - DMODInstallMenuCreate(pBG->GetParent(), "", GetDMODRootPath(), GetSavePath()+fName); + DMODInstallMenuCreate(pBG->GetParent(), "", GetDMODRootPath(), GetSavePath()+fName, false, "", !bIsCommandLineInstall); } else { GameCreate(pBG->GetParent(), 0, fileName, "Continuing last game..."); @@ -606,9 +629,10 @@ Entity * MainMenuCreate( Entity *pParentEnt, bool bFadeIn ) } } + bool bIsCommandLineInstall = false; + - - if ( ! GetNextDMODToInstall().empty()) + if ( ! GetNextDMODToInstall(bIsCommandLineInstall, false).empty()) { pBG->GetFunction("OnStartLoading")->sig_function.connect(&MainOnStartLoading); VariantList vList(pBG, string("")); diff --git a/source/dink/dink.cpp b/source/dink/dink.cpp index fa01860..6e9d7a4 100644 --- a/source/dink/dink.cpp +++ b/source/dink/dink.cpp @@ -16,7 +16,7 @@ bool pre_figure_out(const char *line, int load_seq, bool bLoadSpriteOnly); #define C_DINK_SCREEN_TRANSITION_TIME_MS 400 -const float SAVE_FORMAT_VERSION = 2.9f; +const float SAVE_FORMAT_VERSION = 3.0f; const int C_DINK_FADE_TIME_MS = 300; const float G_TRANSITION_SCALE_TRICK = 1.01f; @@ -1245,7 +1245,7 @@ bool load_game(int num) g_dglos.time_start = 0; } //g_dglos.time_start = GetBaseApp()->GetGameTick(); - + g_dglos.g_dinkTick = GetTick(TIMER_GAME); g_sprite[1].base_idle = g_dglos.g_playerInfo.base_idle; g_sprite[1].base_walk = g_dglos.g_playerInfo.base_walk; g_sprite[1].base_hit = g_dglos.g_playerInfo.base_hit; @@ -1525,6 +1525,7 @@ bool load_hard(void) void blit_background(void) { + rtRect32 rcRect( 0,0,C_DINK_SCREENSIZE_X,C_DINK_SCREENSIZE_Y); lpDDSBack->BltFast( 0, 0, lpDDSBackGround, &rcRect, DDBLTFAST_NOCOLORKEY); @@ -4106,6 +4107,10 @@ bool check_seq_status(int seq, int frame) { if (seq == 0) return true; + if (seq < 0 || seq >= C_MAX_SEQUENCES) + { + assert(!"Illegal sequence!"); + } if (g_dglos.g_seq[seq].active == false) { #ifdef _DEBUG @@ -5595,7 +5600,7 @@ void place_sprites_game(bool bBackgroundOnly ) highest_sprite = 20000; //more than it could ever be rank[r1] = 0; - for (int h1 = 1; h1 < C_MAX_SPRITES_AT_ONCE; h1++) + for (int h1 = 1; h1 < 100; h1++) { if (bs[h1] == false) { @@ -6404,7 +6409,7 @@ restart: if (!bFullRebuild) return; //don't mess with the game tick stuff or initscripts //if script for overall screen, run it - g_dglos.g_dinkTick = GetBaseApp()->GetGameTick(); + //g_dglos.g_dinkTick = GetBaseApp()->GetGameTick(); init_scripts(); } @@ -9881,7 +9886,9 @@ LogMsg("%d scripts used", g_dglos.g_returnint); //remember this change strncpy(g_dglos.g_playerInfo.tile[tileIndex].file, fName.c_str(), 50); //this 50 is hardcoded in the player data - g_forceBuildBackgroundFromScratch = true; + + //don't force it right now? + //g_forceBuildBackgroundFromScratch = true; //BuildScreenBackground(true); //trigger full rebuild, this could be optimized by setting a flag and only doing it once... } @@ -12831,9 +12838,7 @@ void BlitSecondTransitionScreen() //without normal antialiasing we don't need to do much, but this does fix tiny black artifacts during the screen transition dstOffset = rtRectf(-0.05, -0.05f, 0.05f, 0.05); srcOffset = rtRectf(0.4, 0.4, -0.4, -0.4); - } - dstRect.AdjustPosition( ( -g_dglo.m_transitionOffsetNative.x*g_dglo.m_transitionProgress), ( -g_dglo.m_transitionOffsetNative.y*g_dglo.m_transitionProgress)); @@ -16099,6 +16104,8 @@ LastWindowsTimer = GetTickCount(); g_dglos.mbase_count++; + + if (g_dglos.g_dinkTick > g_dglos.g_DinkUpdateTimerMS+100) { // g_dglos.mbase_timing = (g_dglos.mbase_count / 100); @@ -16203,24 +16210,15 @@ LastWindowsTimer = GetTickCount(); //Blit from Two, which holds the base scene. -// lpDDSBack->BltFast( 0, 0, lpDDSBackGround, &rcRect, DDBLTFAST_NOCOLORKEY); + //this doesn't really make much sense to me but it works so not screwing with it + if (g_dglo.m_curView == DinkGlobals::VIEW_ZOOMED) { - -// rtRect32 rcRectGameArea(g_dglo.m_gameArea.left, g_dglo.m_gameArea.top, g_dglo.m_gameArea.right, g_dglo.m_gameArea.bottom); - - //rtRect32 rcRectGameArea(g_dglo.m_nativeGameArea.left, g_dglo.m_nativeGameArea.top, g_dglo.m_nativeGameArea.right, g_dglo.m_nativeGameArea.bottom); - - //rtRect32 rcRectGameArea(g_dglo.m_orthoRenderRect.left, g_dglo.m_nativeGameArea.top, g_dglo.m_nativeGameArea.right, g_dglo.m_nativeGameArea.bottom); - - // lpDDSBack->BltFast(g_dglo.m_gameArea.left, g_dglo.m_gameArea.top, lpDDSBackGround, - // &rcRectGameArea, DDBLTFAST_NOCOLORKEY); - - - lpDDSBack->BltFast(0, 0, lpDDSBackGround, - &g_dglo.m_orthoRenderRect, DDBLTFAST_NOCOLORKEY); - + lpDDSBack->BltFast(g_dglo.m_gameArea.left, g_dglo.m_gameArea.top, lpDDSBackGround, &g_dglo.m_orthoRenderRect, DDBLTFAST_NOCOLORKEY); + } + else + { + lpDDSBack->BltFast(0,0, lpDDSBackGround, &g_dglo.m_orthoRenderRect, DDBLTFAST_NOCOLORKEY); } - g_dglo.m_bgSpriteMan.Render(lpDDSBack); //blit sprites that have been shoved into the bg, too slow to actually add them, so we fake it until the screen is rebuilt @@ -16518,6 +16516,7 @@ void SetDefaultVars(bool bFullClear) g_dglos.g_curPicIndex = 1; //GetBaseApp()->SetGameTick(0); //can cause problems .. don't do it here g_dglos.time_start = GetBaseApp()->GetGameTick(); + g_dglos.g_dinkTick = GetTick(TIMER_GAME); g_dglos.g_playerInfo.minutes = 0; } } @@ -16877,15 +16876,8 @@ void DinkGlobals::SetView( eView view ) switch (view) { case VIEW_ZOOMED: - if (GetFakePrimaryScreenSizeX() != 0) - { -// g_dglo.m_nativeGameArea = rtRectf(0,0,GetPrimaryGLX(),GetPrimaryGLY()); - g_dglo.m_nativeGameArea = rtRectf(0,0,GetScreenSizeX(),GetScreenSizeY()); - } else - { - g_dglo.m_nativeGameArea = rtRectf(0,0,GetScreenSizeX(),GetScreenSizeY()); - } - + + g_dglo.m_nativeGameArea = rtRectf(0,0,GetScreenSizeX(),GetScreenSizeY()); g_dglo.m_gameArea = rtRect32 (20, 0, 620, 400); g_dglo.m_orthoRenderRect = rtRect32 (20, 0, 620, 400); break; diff --git a/windows_vs2017/winRTDink.vcxproj.user b/windows_vs2017/winRTDink.vcxproj.user index 2c50f43..f02a27c 100644 --- a/windows_vs2017/winRTDink.vcxproj.user +++ b/windows_vs2017/winRTDink.vcxproj.user @@ -7,7 +7,7 @@ $(OutDir) WindowsLocalDebugger - -game dmods/init + -game dmods/revolut