From a5da7058edf9ae92eb26294f8d4f8366f4f54643 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 19 Sep 2017 10:58:00 +0000 Subject: [PATCH] * (Bugfix) Fixed issue with not being able to set long delays in sprites (fixed dancing knight in Bugmania) * (Bugfix) Fixed DinkC "!=" command which was renamed "!" for some reason. This fixed the goto in Bugmania * Enabled support for >= and <= in DinkC, not sure why it was commented out before, they were active in 1.08 * (Bugfix) Status bar will now be drawn even when mouse mode is active if needed (it now shows up in Bugmania) * Space no longer selects dialog, you'll have to use ENTER or CONTROL like on 1.08 * Mouse can now be used to select dialog options * Fixed mouse issue with Bugmania in the town where it wasn't sending button down messages (dmod list downloading is currently in a broken state) git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1494 353e56fe-9613-0410-8469-b96ad8e6f29c --- script/win_installer/readme.txt | 13 ++++++- source/Component/CursorComponent.cpp | 3 ++ source/GUI/AboutMenu.cpp | 2 +- source/GUI/BrowseMenu.cpp | 10 +++--- source/GUI/GameMenu.cpp | 3 ++ source/GUI/MainMenu.cpp | 8 +++-- source/dink/dink.cpp | 52 +++++++++++++++++---------- source/dink/dink.h | 6 ++-- windows_vs2017/winRTDink.vcxproj.user | 2 +- 9 files changed, 70 insertions(+), 29 deletions(-) diff --git a/script/win_installer/readme.txt b/script/win_installer/readme.txt index a7b7934..6d7d0f2 100644 --- a/script/win_installer/readme.txt +++ b/script/win_installer/readme.txt @@ -127,4 +127,15 @@ www.rtsoft.com ------ Change log for 1.7.5 ---------- -* Properly handles an illegal frame # sent to sp_frame instead of crashing \ No newline at end of file +* Properly handles an illegal frame # sent to sp_frame instead of crashing +* (Bugfix) Fixed issue with not being able to set long delays in sprites (fixed dancing knight in Bugmania) +* (Bugfix) Fixed DinkC "!=" command which was renamed "!" for some reason. This fixed the goto in Bugmania +* Enabled support for >= and <= in DinkC, not sure why it was commented out before, they were active in 1.08 +* (Bugfix) Status bar will now be drawn even when mouse mode is active if needed (it now shows up in Bugmania) +* Space no longer selects dialog, you'll have to use ENTER or CONTROL like on 1.08 +* Mouse can now be used to select dialog options +* Fixed mouse issue with Bugmania in the town where it wasn't sending button down messages + + + +- Note: Save state format has been changed again, so old save states won't load diff --git a/source/Component/CursorComponent.cpp b/source/Component/CursorComponent.cpp index 2480335..7838c2f 100644 --- a/source/Component/CursorComponent.cpp +++ b/source/Component/CursorComponent.cpp @@ -84,6 +84,7 @@ void CursorComponent::OnInput( VariantList *pVList ) OnUpdatePos(pt); g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true; + g_dinkMouseRightClick = true; break; case MESSAGE_TYPE_GUI_CLICK_END: @@ -121,6 +122,8 @@ void CursorComponent::OnInput( VariantList *pVList ) OnUpdatePos(pt); g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true; + g_dinkMouseRightClick = true; + } //HandleClickEnd(pt); diff --git a/source/GUI/AboutMenu.cpp b/source/GUI/AboutMenu.cpp index 85d2c8b..615a4e8 100644 --- a/source/GUI/AboutMenu.cpp +++ b/source/GUI/AboutMenu.cpp @@ -405,7 +405,7 @@ msg += \ vTextBoxPos = CL_Vec2f(iPhoneMapX(x),y); msg = "`8`$Dink Smallwood HD`` was created by `wSeth A. Robinson`` (code) and `wJustin Martin`` (graphics).\n\n"\ - "`8The original `$Dink Smallwood`` was created by `wSeth A. Robinson`` (engine/scripting/music), `wJustin Martin`` (graphics), `wGreg Smith`` (scripting/music), and `wShawn Teal``. It also featured music by `wJoel Bakker``."\ + "`8The original `$Dink Smallwood`` was created by `wSeth A. Robinson`` (engine/scripting/music), `wJustin Martin`` (graphics), `wGreg Smith`` (scripting/music), and `wShawn Teal``. It also featured music by `wJoel Bakker`` and `wMitch Brink``."\ "\n\nSpecial thanks to `wDan Walma`` and the `wdinksmallwood.net`` community for their `$Dink`` improvements."\ "\n\n"\ "This product is less buggy thanks to:\n\n`w"\ diff --git a/source/GUI/BrowseMenu.cpp b/source/GUI/BrowseMenu.cpp index 82f53ae..4b0a7ca 100644 --- a/source/GUI/BrowseMenu.cpp +++ b/source/GUI/BrowseMenu.cpp @@ -265,17 +265,19 @@ void DownloadDMODList(Entity *pMenu) VariantList v; - string url; - uint32 port; - GetApp()->GetServerInfo(url, port); + string url = "www.dinknetwork.com"; + uint32 port = 80; + //GetApp()->GetServerInfo(url, port); v.m_variant[0].Set(url); v.m_variant[1].Set(port); - v.m_variant[2].Set("dink/getaddons.php"); + v.m_variant[2].Set("api"); + v.m_variant[3].Set(uint32(NetHTTP::END_OF_DATA_SIGNAL_HTTP)); //need this for it to detect a disconnect instead of the weird RTsoft symbol pComp->GetFunction("Init")->sig_function(&v); pComp->GetFunction("OnError")->sig_function.connect(&OnDownloadError); pComp->GetFunction("OnFinish")->sig_function.connect(&OnDownloadHTTPFinish); + Entity *pEnt = ShowScoreMessage(pMenu, "`6"); EntityComponent *pTyper = pEnt->AddComponent(new TyperComponent); pTyper->GetVar("text")->Set("Downloading add-on list..."); diff --git a/source/GUI/GameMenu.cpp b/source/GUI/GameMenu.cpp index ec53d0f..dd0d3c5 100644 --- a/source/GUI/GameMenu.cpp +++ b/source/GUI/GameMenu.cpp @@ -761,8 +761,11 @@ void BuildDialogModeControls(float fadeTimeMS) return; } + pBG = pBG->AddEntity(new Entity("Controls")); + pBG->AddComponent(new CursorComponent); //for mouse control of dialog + if (!GetApp()->GetUsingTouchScreen()) return; float trans = 0.0f; diff --git a/source/GUI/MainMenu.cpp b/source/GUI/MainMenu.cpp index 6f11597..db4b29b 100644 --- a/source/GUI/MainMenu.cpp +++ b/source/GUI/MainMenu.cpp @@ -461,12 +461,16 @@ void CheckForNewVersion(Entity *pMenu) v.m_variant[2].Set("dink/versions.php"); pComp->GetFunction("OnError")->sig_function.connect(&OnVersionDownloadError); pComp->GetFunction("OnFinish")->sig_function.connect(&OnVersionDownloadHTTPFinish); - pComp->GetFunction("Init")->sig_function(&v); + + + //pComp->GetFunction("Init")->sig_function(&v); + GetMessageManager()->CallComponentFunction(pComp,1000, "Init", &v); //call it in a bit Entity *pEnt = VersionShowScoreMessage(pMenu, "`6"); EntityComponent *pTyper = pEnt->AddComponent(new TyperComponent); pTyper->GetVar("text")->Set("Checking rtsoft.com for updates..."); - pTyper->GetVar("speedMS")->Set(uint32(50)); + pTyper->GetVar("speedMS")->Set(uint32(30)); + } Entity * MainMenuCreate( Entity *pParentEnt, bool bFadeIn ) diff --git a/source/dink/dink.cpp b/source/dink/dink.cpp index 7169896..890d3b3 100644 --- a/source/dink/dink.cpp +++ b/source/dink/dink.cpp @@ -16,12 +16,14 @@ 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.3f; +const float SAVE_FORMAT_VERSION = 2.4f; const int C_DINK_FADE_TIME_MS = 300; const float G_TRANSITION_SCALE_TRICK = 1.01f; bool g_forceBuildBackgroundFromScratch = false; +bool g_dinkMouseRightClick = false; + float g_dinkFadeAlpha = 0; DinkGlobals g_dglo; @@ -1903,7 +1905,7 @@ void ReadFromLoadSequenceString(char ev[15][100] ) #ifdef _DEBUG - if (seqID == 35) + if (seqID == 150) { LogMsg("Found seq %d", seqID); } @@ -2689,10 +2691,11 @@ bool SwitchToRGBAIfNeeded(LPDIRECTDRAWSURFACE *pDXSurf, SoftSurface *pSoftSurf) return false; } + void BlitGUIOverlay() { - if (GetDinkGameMode() == DINK_GAME_MODE_MOUSE) return; + //if (GetDinkGameMode() == DINK_GAME_MODE_MOUSE) return; if (GetDinkSubGameMode() == DINK_SUB_GAME_MODE_SHOWING_BMP) return; @@ -3170,6 +3173,8 @@ bool read_next_line(int script, char *line) { // Msg("..%d",k); strchar(line, g_scriptBuffer[script][k]); + + g_scriptInstance[script]->current++; if ( (g_scriptBuffer[script][k] == '\n') || (g_scriptBuffer[script][k] == '\r') ) @@ -6675,15 +6680,14 @@ pass: return(0); } - /* if (strchr(temp, '<=') != NULL) { h = &h[1]; strip_beginning_spaces(h); process_line(script, h, false); replace("==", "", temp); - sprintf(line, "%d <= %s", returnint, temp); - returnint = var_figure(line, script); + sprintf(line, "%d <= %s", g_dglos.g_returnint, temp); + g_dglos.g_returnint = var_figure(line, script); strcpy(h, "\n"); return(0); } @@ -6693,14 +6697,14 @@ pass: strip_beginning_spaces(h); process_line(script, h, false); replace("==", "", temp); - sprintf(line, "%d >= %s", returnint, temp); - returnint = var_figure(line, script); + sprintf(line, "%d >= %s", g_dglos.g_returnint, temp); + g_dglos.g_returnint = var_figure(line, script); strcpy(h, "\n"); return(0); } - */ + - if (strchr(temp, '!') != NULL) + if (strchr(temp, '!=') != NULL) { h = &h[1]; strip_beginning_spaces(h); @@ -7648,7 +7652,7 @@ pass: if (compare(ev[1], (char*)"draw_background")) { - BuildScreenBackground(false); + BuildScreenBackground(false, true); strcpy(pLineIn, h); return(0); } @@ -10430,7 +10434,7 @@ crappa: redo2: if (!read_next_line(script, line)) { - //script is actualyl empty + //script is actually empty break; } strip_beginning_spaces(line); @@ -13135,11 +13139,12 @@ void mouse_brain(int h) } } - if ( (sjoy.button[1] == true)) + if ( sjoy.button[1] == true || g_dinkMouseRightClick) { LogMsg("running through mouse list.."); run_through_mouse_list(h, true); sjoy.button[1] = false; + g_dinkMouseRightClick = false; } } @@ -14708,8 +14713,9 @@ fin: if (GetBaseApp()->GetGameTickPause()) return; - if ( (sjoy.button[1]) || (sjoy.button[2])) + if ( sjoy.button[1] || g_dinkMouseRightClick) //(sjoy.button[2])) { + g_dinkMouseRightClick = false; g_dglos.g_talkInfo.active = false; *presult = g_dglos.g_talkInfo.line_return[g_dglos.g_talkInfo.cur]; SoundPlayEffect(17, 22050,0,0,0); @@ -14740,15 +14746,25 @@ CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos) void DinkSetCursorPosition(CL_Vec2f vPos) { + static float vLastMouseY = vPos.y; + float difY = vPos.y - vLastMouseY; + vLastMouseY = vPos.y; + if (g_sprite[1].active) if (g_sprite[1].brain == 13) { g_sprite[1].x = vPos.x; g_sprite[1].y = vPos.y; -#ifdef _DEBUG - //LogMsg("Mouse X: %d, Y: %d", g_sprite[1].x, g_sprite[1].y); -#endif + } + + if (g_dglos.g_gameMode == 1) //dialog select? + { + + //LogMsg("Mouse diff: %.2f", difY); + g_dglos.g_playerInfo.mouse += difY; + } + } void UpdateCursorPosition(int dx, int dy) @@ -16861,7 +16877,7 @@ bool LoadHeader(FILE *fp) { float version; LoadFromFile(version, fp); - if (version < SAVE_FORMAT_VERSION) + if (version < SAVE_FORMAT_VERSION) //save_state_version { LogMsg("Save state from newer version?!"); return false; diff --git a/source/dink/dink.h b/source/dink/dink.h index 0c4af27..dee70df 100644 --- a/source/dink/dink.h +++ b/source/dink/dink.h @@ -12,6 +12,8 @@ #include "misc_util.h" #include "video_gl.h" #include "util/TextScanner.h" + +extern bool g_dinkMouseRightClick; bool InitDinkEngine(); bool LoadGameChunk(int gameIDToLoad, float &progressOut); //0 for new game void updateFrame(); @@ -182,7 +184,7 @@ struct sequence { int16 frame[C_MAX_SPRITE_FRAMES]; int16 originalFrame[C_MAX_SPRITE_FRAMES]; - int16 delay[C_MAX_SPRITE_FRAMES]; + int32 delay[C_MAX_SPRITE_FRAMES]; unsigned char special[C_MAX_SPRITE_FRAMES]; byte active; @@ -190,7 +192,7 @@ struct sequence rtRect32 m_hardbox; eTransparencyType m_transType; byte m_bLeftAlign; - byte m_speed; + int32 m_speed; char m_fileName[C_SPRITE_MAX_FILENAME_SIZE]; short x,y; short s; diff --git a/windows_vs2017/winRTDink.vcxproj.user b/windows_vs2017/winRTDink.vcxproj.user index bc7f609..c16b794 100644 --- a/windows_vs2017/winRTDink.vcxproj.user +++ b/windows_vs2017/winRTDink.vcxproj.user @@ -7,6 +7,6 @@ $(ProjectDir) WindowsLocalDebugger - -game dmods/init + -game dmods/bugmania \ No newline at end of file