diff --git a/OSX/Info.plist b/OSX/Info.plist
index 239f5c3..9434a1b 100644
--- a/OSX/Info.plist
+++ b/OSX/Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.8.6
+ 1.8.7
CFBundleSignature
????
CFBundleVersion
- 1.8.6
+ 1.8.7
LSMinimumSystemVersion
${MACOSX_DEPLOYMENT_TARGET}
NSMainNibFile
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 30171da..be3997f 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 7972317..cc4045a 100644
--- a/script/win_installer/readme.txt
+++ b/script/win_installer/readme.txt
@@ -262,3 +262,11 @@ a specific speed, but by choosing rather snappy speed hopefully mystery island a
* 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
+
+------ Change log for 1.8.7 ----------
+
+* Savestates should now properly restore the background in dmods that use mouse controls and tiles at the same time
+* Some tweaks with when mouse buttons are processed (only in mouse cursor modes or a dialog menu)
+* Misc work on touch controls to prepare for the mobile releases
+* Added some names to credits (if you notice I added anybody twice or would rather be credited a different way or not at all, let me know!)
+* Fixed bug that could sort of over-write random data if more than 100 sprites were active.. wow, bad
\ No newline at end of file
diff --git a/source/App.cpp b/source/App.cpp
index c2a92f8..3178209 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.86f;
- m_versionString = "V1.8.6";
+ m_version = 1.87f;
+ m_versionString = "V1.8.7";
m_build = 1;
m_bCheatsEnabled = false;
@@ -802,7 +802,7 @@ void App::OnScreenSizeChange()
{
SetupOrtho();
DinkOnForeground(); //rebuild lost surfaces
-
+ g_dglo.m_bForceControlsRebuild = true;
if (GetDinkGameState() != DINK_GAME_STATE_PLAYING)
{
PrepareForGL();
diff --git a/source/Component/CursorComponent.cpp b/source/Component/CursorComponent.cpp
index f3f2bc1..3af8578 100644
--- a/source/Component/CursorComponent.cpp
+++ b/source/Component/CursorComponent.cpp
@@ -85,10 +85,12 @@ void CursorComponent::OnInput( VariantList *pVList )
if (!m_bDisable)
{
-
- g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
- g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
- g_dinkMouseRightClick = true;
+ if (DinkIsMouseActive() || g_dglo.m_lastSubGameMode == DINK_SUB_GAME_MODE_DIALOG)
+ {
+ g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
+ g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
+ g_dinkMouseRightClick = true;
+ }
}
break;
@@ -125,9 +127,12 @@ void CursorComponent::OnInput( VariantList *pVList )
if (!m_bDisable)
{
OnUpdatePos(pt);
- g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
- g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
- g_dinkMouseRightClick = true;
+ if (DinkIsMouseActive())
+ {
+ g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
+ g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
+ g_dinkMouseRightClick = true;
+ }
}
diff --git a/source/GUI/AboutMenu.cpp b/source/GUI/AboutMenu.cpp
index 615a4e8..6958125 100644
--- a/source/GUI/AboutMenu.cpp
+++ b/source/GUI/AboutMenu.cpp
@@ -431,7 +431,20 @@ msg += \
"Brett Profitt\n"\
"Chris Black\n"\
"Erik Harrison\n"\
- "James Hutt\n";
+ "James Hutt\n" \
+ "Robj\n"\
+ "liquid141\n"\
+ "Tal\n"\
+ "Quiztis\n"\
+ "rabidwolf9\n"\
+ "RangerLord\n"\
+ "LeProChaUn\n"\
+ "DinkDude95\n"\
+ "thenewguy\n"\
+
+
+ ;
+
if (GetEmulatedPlatformID() == PLATFORM_ID_WINDOWS || GetEmulatedPlatformID() == PLATFORM_ID_IOS)
{
diff --git a/source/GUI/GameMenu.cpp b/source/GUI/GameMenu.cpp
index 1e9b34f..a30c6bf 100644
--- a/source/GUI/GameMenu.cpp
+++ b/source/GUI/GameMenu.cpp
@@ -27,7 +27,6 @@ void UpdatePauseMenuPosition(Entity *pBG);
void ShowQuickMessage(string msg)
{
-
Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu");
//assert(pMenu);
if (!pMenu)
@@ -66,8 +65,6 @@ void ShowQuickMessageBottom(string msg)
void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
-
-
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu");
@@ -196,6 +193,7 @@ void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent fr
g_dglo.ToggleView();
return;
}
+
if (pEntClicked->GetName() == "speedup")
{
@@ -316,9 +314,7 @@ void AddViewModeHotspot(Entity *pBG)
}
CL_Vec2f vPos = pButtonEntity->GetVar("pos2d")->GetVector2();
CL_Vec2f vSize = pButtonEntity->GetVar("size2d")->GetVector2();
-
-
-
+
if (GetApp()->GetVar("showViewHint")->GetUINT32() == 1)
{
GetApp()->GetVar("showViewHint")->Set(uint32(0)); //so this won't be shown again
@@ -331,7 +327,6 @@ void AddViewModeHotspot(Entity *pBG)
Entity *pLabel = CreateTextLabelEntity(pOverlay, "label",vLabelPos.x, vLabelPos.y, "Tap here to toggle view");
SetAlignmentEntity(pLabel, ALIGNMENT_CENTER);
-
//fade them in
FadeInEntity(pOverlay, true, 500, 1000);
//fade them out
@@ -386,7 +381,6 @@ void AddSpeedUpButton(Entity *pBG)
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_LEFT);
SetButtonClickSound(pButtonEntity, ""); //no sound
-
SetAlphaEntity(pButtonEntity, GetApp()->GetVar("gui_transparency")->GetFloat());
//pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
@@ -413,11 +407,8 @@ void OnGameKillKeyboard(VariantList *pVList)
{
g_dglo.m_bFullKeyboardActive = false;
//g_dglo.m_bLastFullKeyboardActive = false;
-
}
-
-
void OnGameProcessHWKey(VariantList *pVList)
{
if (pVList->Get(0).GetFloat() != MESSAGE_TYPE_GUI_CHAR) return;
@@ -455,7 +446,6 @@ void OnGameProcessHWKey(VariantList *pVList)
void OnGameProcessKey(VariantList *pVList)
{
-
if (DinkCanRunScriptNow())
{
@@ -572,8 +562,6 @@ void BuildInventoryControls(float fadeTimeMS)
SetTouchPaddingEntity(pButtonEntity, CL_Rectf(20,15,40,40));
SetButtonClickSound(pButtonEntity, ""); //no sound
}
-
-
}
void BuildShowingBMPControls(float fadeTimeMS)
@@ -603,7 +591,6 @@ void BuildShowingBMPControls(float fadeTimeMS)
}
}
-
void BuildControls(float fadeTimeMS)
{
Entity *pBG = GetEntityRoot()->GetEntityByName("GameMenu");
@@ -622,49 +609,47 @@ void BuildControls(float fadeTimeMS)
float trans = 0.0f;
Entity *pButtonEntity;
-
if (GetApp()->GetUsingTouchScreen())
{
- if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar())
- {
- //not zoomed in
-
- if (IsIPADSize)
+ if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar())
{
- iconX = FlipXIfNeeded(864);
- iconStartY = 120;
- iconSpacerY = iPhoneMapY(72);
+ //not zoomed in
- } else if (IsIphone4Size)
- {
- iconX = FlipXIfNeeded(820);
- iconStartY = 5;
- }
+ if (IsIPADSize)
+ {
+ iconX = FlipXIfNeeded(864);
+ iconStartY = 120;
+ iconSpacerY = iPhoneMapY(72);
- } else
- {
- //adjust for fullscreen view
- if (IsIPADSize)
- {
- iconX = FlipXIfNeeded(890);
- iconStartY = 100;
- iconSpacerY = iPhoneMapY(72);
+ } else if (IsIphone4Size)
+ {
+ iconX = FlipXIfNeeded(820);
+ iconStartY = 5;
+ }
- } else if (IsIphone4Size)
- {
- iconX = FlipXIfNeeded(820);
- iconStartY = 5;
- iconSpacerY = iPhoneMapY(76);
} else
{
- //old iphone
- iconSpacerY = iPhoneMapY(76);
- iconX = FlipXIfNeeded(iPhoneMapX(416));
+ //adjust for fullscreen view
+ if (IsIPADSize)
+ {
+ iconX = FlipXIfNeeded(890);
+ iconStartY = 100;
+ iconSpacerY = iPhoneMapY(72);
+
+ } else if (IsIphone4Size)
+ {
+ iconX = FlipXIfNeeded(820);
+ iconStartY = 5;
+ iconSpacerY = iPhoneMapY(76);
+ } else
+ {
+ //old iphone
+ iconSpacerY = iPhoneMapY(76);
+ iconX = FlipXIfNeeded(iPhoneMapX(416));
+ }
}
- }
-
-float iconY = iconStartY;
+ float iconY = iconStartY;
//make the area where if you touch it the screen zoom will change
@@ -673,6 +658,7 @@ float iconY = iconStartY;
//game icons
pButtonEntity = CreateOverlayButtonEntity(pBG, "inventory", ReplaceWithLargeInFileName("interface/iphone/button_inventory.rttex"), iconX, iconY);
+
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
pButtonEntity->GetVar("alpha")->Set(trans);
iconY += iconSpacerY;
@@ -701,20 +687,35 @@ float iconY = iconStartY;
//pButtonEntity->GetComponentByName("Button2D")->GetVar("buttonStyle")->Set((uint32) Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
SetButtonClickSound(pButtonEntity, ""); //no sound
-
-
+
pButtonEntity->GetParent()->MoveEntityToBottomByAddress(pButtonEntity);
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar())
{
- pButtonEntity = CreateButtonHotspot(pBG, "magic", CL_Vec2f(iPhoneMapX(113), iPhoneMapY(272)), CL_Vec2f(iPhoneMapX(55), iPhoneMapY(46)), Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
+ //make it so touching the actual game icons on the bottom of the screen do stuff
+#ifdef _DEBUG
+ //trans = 0.7f;
+#endif
+
+ /*
+ RecomputeAspectRatio();
+ ApplyAspectRatioGLMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ */
+
+
+ CL_Vec2f vButtonSize = DinkToNativeCoords(CL_Vec2f(152+64, 412+54)) - DinkToNativeCoords(CL_Vec2f(152, 412));
+ pButtonEntity = CreateButtonHotspot(pBG, "magic", DinkToNativeCoords(CL_Vec2f(152, 412)), vButtonSize, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
+ SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_LEFT);
pButtonEntity->GetVar("alpha")->Set(trans);
+
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
SetButtonClickSound(pButtonEntity, ""); //no sound
//I made this touchspot too big on purpose, easier to hit it.
- pButtonEntity = CreateButtonHotspot(pBG, "attack", CL_Vec2f(iPhoneMapX(412), iPhoneMapY(272)), CL_Vec2f(iPhoneMapX(62), iPhoneMapY(46)), Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
+ pButtonEntity = CreateButtonHotspot(pBG, "attack", DinkToNativeCoords(CL_Vec2f(556, 412)),vButtonSize, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
iconY += iconSpacerY;
pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
@@ -823,7 +824,7 @@ void BuildDialogModeControls(float fadeTimeMS)
pBG = pBG->AddEntity(new Entity("Controls"));
- pBG->AddComponent(new CursorComponent); //for mouse control of dialog
+ EntityComponent *pCursor = pBG->AddComponent(new CursorComponent); //for mouse control of dialog
if (!GetApp()->GetUsingTouchScreen()) return;
@@ -890,38 +891,47 @@ void BuildDialogModeControls(float fadeTimeMS)
if (!IsInFlingMode())
{
+ pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_up", ReplaceWithLargeInFileName("interface/iphone/button_arrow_up.rttex"), vUpArrowPos.x, vUpArrowPos.y);
+ pButtonEntity->GetVar("alpha")->Set(trans);
+ pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
+ pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
+ SetButtonClickSound(pButtonEntity, ""); //no sound
+ Entity * pUp = pButtonEntity;
-
- pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_up", ReplaceWithLargeInFileName("interface/iphone/button_arrow_up.rttex"), vUpArrowPos.x, vUpArrowPos.y);
- pButtonEntity->GetVar("alpha")->Set(trans);
- pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
- pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
- SetButtonClickSound(pButtonEntity, ""); //no sound
- Entity * pUp = pButtonEntity;
+ if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
- if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
-
- pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_down", ReplaceWithLargeInFileName("interface/iphone/button_arrow_down.rttex"), vDownArrowPos.x, vDownArrowPos.y);
- pButtonEntity->GetVar("alpha")->Set(trans);
- pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
- if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
- pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
- SetButtonClickSound(pButtonEntity, ""); //no sound
- Entity * pDown = pButtonEntity;
+ pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_down", ReplaceWithLargeInFileName("interface/iphone/button_arrow_down.rttex"), vDownArrowPos.x, vDownArrowPos.y);
+ pButtonEntity->GetVar("alpha")->Set(trans);
+ pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
+ if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
+ pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
+ SetButtonClickSound(pButtonEntity, ""); //no sound
+ Entity * pDown = pButtonEntity;
}
pButtonEntity = CreateOverlayButtonEntity(pBG, "select", ReplaceWithLargeInFileName("interface/iphone/button_arrow_back.rttex"), vOkPos.x, vOkPos.y);
pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&GameOnSelect);
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
+
+
//pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
//SetButtonStyleEntity(pButtonEntity, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH_RELEASE);
SetButtonClickSound(pButtonEntity, ""); //no sound
//SetButtonRepeatDelayMS(pButtonEntity, 1);
Entity * pSelect = pButtonEntity;
-
- FadeEntity(pBG, true, GetApp()->GetVar("gui_transparency")->GetFloat(), fadeTimeMS, 0);
+
+ FadeEntity(pBG, true, GetApp()->GetVar("gui_transparency")->GetFloat(), fadeTimeMS, 0);
+
+
+ //disable it until it's visible
+ DisableComponentByName(pButtonEntity, "Button2D");
+ EnableComponentByName(pButtonEntity, "Button2D", 1000);
+
+ //override the fading on this one button because we want them to see it's not clickable yet
+ FadeEntity(pButtonEntity, false, 0, 0, 0, false);
+ FadeInEntity(pButtonEntity, false, 300, 900, GetApp()->GetVar("gui_transparency")->GetFloat());
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED)
{
@@ -936,6 +946,8 @@ void BuildDialogModeControls(float fadeTimeMS)
SetButtonClickSound(pButtonEntity, ""); //no sound
}
}
+
+ pBG->MoveComponentToBottomByAddress(pCursor);
}
void RecomputeAspectRatio();
@@ -949,6 +961,7 @@ void UpdateControlsGUIIfNeeded()
|| g_dglo.m_lastActiveView != g_dglo.GetActiveView()
|| g_dglo.m_lastIsUpdatingDinkStatusBar != IsDrawingDinkStatusBar()
|| g_dglo.m_bFullKeyboardActive != g_dglo.m_bLastFullKeyboardActive
+ || g_dglo.m_bForceControlsRebuild
)
{
@@ -957,7 +970,7 @@ void UpdateControlsGUIIfNeeded()
//don't care, leave the keyboard up
return;
}
-
+ g_dglo.m_bForceControlsRebuild = false;
//kill any existing controls
KillControls(300);
@@ -971,7 +984,7 @@ void UpdateControlsGUIIfNeeded()
GetEntityRoot()->GetComponentByName("ArcadeInput")->GetVar("trackball_mode")->Set(uint32(ArcadeInputComponent::TRACKBALL_MODE_WALKING));
Entity *pMainMenu = GetEntityRoot()->GetEntityByName("GameMenu");
- RecomputeAspectRatio();
+ //RecomputeAspectRatio();
AddSpeedUpButton(pMainMenu);
UpdatePauseMenuPosition(pMainMenu);
@@ -1018,11 +1031,9 @@ void ApplyAspectRatioGLMatrix();
void OnGameMenuRender(VariantList *pVList)
{
-
//apply matrix
glMatrixMode(GL_MODELVIEW);
-
//well, we might as well always clear the BG, because some dmods like redink1 set transparency in the status bar which causes glitches if we don't
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED)
@@ -1051,15 +1062,12 @@ void OnGameMenuRender(VariantList *pVList)
}
}
-
-
-
+
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
//remove matrix
-
-
}
+
void OnAutoSave(VariantList *pVList)
{
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING && DinkGetHealthPercent() > 0.3f)
@@ -1079,7 +1087,6 @@ void OnAutoSave(VariantList *pVList)
//if we got here, we failed to save due to it being dangerous because of low health. Let's try again in a few seconds...
GetMessageManager()->CallEntityFunction(pVList->Get(0).GetEntity(), 5000, "OnAutoSave", pVList);
-
}
void OnArcadeInput(VariantList *pVList)
@@ -1114,9 +1121,6 @@ void OnArcadeInput(VariantList *pVList)
{
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING)
{
-
-
-
string fName = DinkGetSavePath() + "quicksave.dat";
if (FileExists(fName))
@@ -1135,6 +1139,7 @@ void OnArcadeInput(VariantList *pVList)
}
}
break;
+
case VIRTUAL_KEY_GAME_MAGIC:
if (bIsDown)
@@ -1150,10 +1155,8 @@ void OnArcadeInput(VariantList *pVList)
} else
{
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON3] = true;
-
}
break;
-
//EXAMINE
case VIRTUAL_KEY_GAME_TALK:
@@ -1174,7 +1177,6 @@ void OnArcadeInput(VariantList *pVList)
} else
{
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON2] = true;
-
}
break;
@@ -1186,7 +1188,6 @@ void OnArcadeInput(VariantList *pVList)
} else
{
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON4] = true;
-
}
break;
@@ -1242,10 +1243,7 @@ void OnRawCharInput(VariantList *pVList)
int vKey = pVList->Get(0).GetUINT32();
bool bIsDown = pVList->Get(1).GetUINT32() != 0;
-
//LogMsg("GameMenuRaw: Key %d, down is %d", vKey, int(bIsDown));
-
-
}
void UpdatePauseMenuPosition(Entity *pBG)
@@ -1394,6 +1392,7 @@ void GameLoadPiece(VariantList *pVList)
pBG->GetVar("didInit")->Set(uint32(1));
}
+
if (progress == 1)
{
//we're done
@@ -1436,7 +1435,6 @@ void GameLoadPiece(VariantList *pVList)
GetMessageManager()->CallEntityFunction(pBG, 1, "GameLoadPiece", &vList);
return;
}
-
}
if (!LoadGameChunk(gameIdToLoad, progress))
@@ -1458,7 +1456,6 @@ Entity * GameCreate(Entity *pParentEnt, int gameIDToLoad, string stateToLoad, st
Entity *pBG = pParentEnt->AddEntity(new Entity("GameMenu"));
AddFocusIfNeeded(pBG);
Entity *pLoading = CreateOverlayEntity(pBG, "game_loading", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0, 0);
-
//setup the splash too
string splashBmp;
diff --git a/source/dink/dink.cpp b/source/dink/dink.cpp
index 6e9d7a4..cac5b96 100644
--- a/source/dink/dink.cpp
+++ b/source/dink/dink.cpp
@@ -9,6 +9,10 @@
#include "Renderer/SoftSurface.h"
#include "FileSystem/StreamingInstance.h"
#include
+
+const int C_DINK_MAX_ITEMS = 16;
+const int C_DINK_MAX_MAGICS = 8;
+
void ThinkSprite(int h, bool get_frame);
void ApplyAspectRatioGLMatrix();
@@ -1348,7 +1352,7 @@ void kill_cur_item( void )
void kill_cur_item_script( char name[20])
{
int select = 0;
- for (int i = 1; i < 17; i++)
+ for (int i = 1; i < C_DINK_MAX_ITEMS + 1; i++)
{
if (g_dglos.g_playerInfo.g_itemData[i].active)
if (compare(g_dglos.g_playerInfo.g_itemData[i].name, name))
@@ -5395,7 +5399,7 @@ void changedir( int dir1, int k,int base)
void update_play_changes( void )
{
- for (int j = 1; j < C_MAX_SPRITES_AT_ONCE; j++)
+ for (int j = 1; j < 100; j++)
{
if (g_dglos.g_smallMap.sprite[j].active)
if (g_dglos.g_playerInfo.spmap[*pmap].type[j] != 0)
@@ -6490,7 +6494,7 @@ void add_item(char name[10], int mseq, int mframe, bool magic)
{
//add reg item
- for (int i = 1; i < 17; i ++)
+ for (int i = 1; i < C_DINK_MAX_ITEMS + 1; i ++)
{
if (g_dglos.g_playerInfo.g_itemData[i].active == false)
{
@@ -6498,7 +6502,7 @@ void add_item(char name[10], int mseq, int mframe, bool magic)
LogMsg("Weapon/item %s added to inventory.",name);
g_dglos.g_playerInfo.g_itemData[i].seq = mseq;
g_dglos.g_playerInfo.g_itemData[i].frame = mframe;
- strcpy(g_dglos.g_playerInfo.g_itemData[i].name, name);
+ strncpy(g_dglos.g_playerInfo.g_itemData[i].name, name, 10);
g_dglos.g_playerInfo.g_itemData[i].active = true;
//if (debug_mode)
// LogMsg("wep: Checking seq",name);
@@ -6530,7 +6534,7 @@ void add_item(char name[10], int mseq, int mframe, bool magic)
LogMsg("Magic %s added to inventory.",name);
g_dglos.g_playerInfo.g_MagicData[i].seq = mseq;
g_dglos.g_playerInfo.g_MagicData[i].frame = mframe;
- strcpy(g_dglos.g_playerInfo.g_MagicData[i].name, name);
+ strncpy(g_dglos.g_playerInfo.g_MagicData[i].name, name, 10);
g_dglos.g_playerInfo.g_MagicData[i].active = true;
//check_seq_status(mseq, mframe);
@@ -7319,7 +7323,7 @@ pass:
if (compare(ev[1], (char*)"free_items"))
{
g_dglos.g_returnint = 0;
- for (int i = 1; i < 17; i ++)
+ for (int i = 1; i < C_DINK_MAX_ITEMS + 1; i ++)
{
if (g_dglos.g_playerInfo.g_itemData[i].active == false)
{
@@ -9433,7 +9437,7 @@ pass:
if (get_parms(ev[1], script, h, p))
{
g_dglos.g_returnint = 0;
- for (int i = 1; i < 17; i++)
+ for (int i = 1; i < C_DINK_MAX_ITEMS + 1; i++)
{
if (g_dglos.g_playerInfo.g_itemData[i].active)
{
@@ -10181,7 +10185,7 @@ LogMsg("%d scripts used", g_dglos.g_returnint);
if (get_parms(ev[1], script, h, p))
{
g_dglos.g_returnint = 0;
- for (int i = 1; i < 17; i++)
+ for (int i = 1; i < C_DINK_MAX_ITEMS + 1; i++)
{
if (g_dglos.g_playerInfo.g_itemData[i].active)
{
@@ -14967,6 +14971,28 @@ CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos)
}
+CL_Vec2f DinkToNativeCoords(CL_Vec2f vPos)
+{
+ CL_Vec2f r = vPos;
+ float xmod = (float(g_dglo.m_orthoRenderRect.GetWidth()) / GetScreenSizeXf());
+ float ymod = (float(g_dglo.m_orthoRenderRect.GetHeight()) / GetScreenSizeYf());
+ r += g_dglo.m_centeringOffset;
+ r.x *= g_dglo.m_aspectRatioModX;
+ r.y *= g_dglo.m_aspectRatioModY;
+
+ r.x /= xmod;
+ r.y /= ymod;
+ return r;
+}
+
+bool DinkIsMouseActive()
+{
+ if (g_sprite[1].active) if (g_sprite[1].brain == 13)
+ {
+ return true;
+ }
+ return false;
+}
void DinkSetCursorPosition(CL_Vec2f vPos)
{
@@ -14976,10 +15002,11 @@ void DinkSetCursorPosition(CL_Vec2f vPos)
if (g_sprite[1].active) if (g_sprite[1].brain == 13)
{
+#ifdef _DEBUG
+ //LogMsg("Setting pos %s", toString(vPos).c_str());
+#endif
g_sprite[1].x = vPos.x;
g_sprite[1].y = vPos.y;
-
-
}
if (g_dglos.g_talkInfo.active != 0 && fabs(difY) < 100) //dialog select? the 100 is an ugly hack to get rid of accumulated pixels due to .. something
@@ -14988,7 +15015,10 @@ void DinkSetCursorPosition(CL_Vec2f vPos)
#ifdef _DEBUG
//LogMsg("Mouse diff: %.2f", difY);
#endif
- g_dglos.g_playerInfo.mouse += difY;
+ if (!GetApp()->GetUsingTouchScreen())
+ {
+ g_dglos.g_playerInfo.mouse += difY;
+ }
}
}
@@ -15114,8 +15144,7 @@ CL_Rect GetItemRectFromIndex(int num, bool magic)
return CL_Rect(mx, my, mx+65, my+55);
}
-const int C_DINK_MAX_ITEMS = 16;
-const int C_DINK_MAX_MAGICS = 8;
+
void SetCurInventoryPositionIndex(int itemIndex, bool bIsMagic)
{
@@ -16429,7 +16458,7 @@ void SetDefaultVars(bool bFullClear)
g_dglo.m_lastGameMode = DINK_GAME_MODE_NONE;
g_dglo.m_lastSubGameMode = DINK_SUB_GAME_MODE_NONE;
g_dglo.m_bFullKeyboardActive = false;
-
+ g_dglo.m_bForceControlsRebuild = false;
g_dglo.m_bWaitingForSkippableConversation = false;
g_dglos.g_DinkUpdateTimerMS =0;
@@ -17690,8 +17719,8 @@ void ApplyAspectRatioGLMatrix()
glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0]);
g_dglo.m_dink_matrix = mat;
//OPTIMIZE - All this can be cached... maybe done in RecomputeAspectRatio()
-
mat.inverse();
+ g_dglo.m_dink_matrix_inverted = mat;
CL_Vec3f vTotal = mat.get_transformed_point(CL_Vec3f(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, 0));
CL_Vec3f vDinkSize = mat.get_transformed_point(CL_Vec3f(C_DINK_SCREENSIZE_X*g_dglo.m_aspectRatioModX, C_DINK_SCREENSIZE_Y *g_dglo.m_aspectRatioModY, 0));
@@ -17805,7 +17834,7 @@ void DinkOnForeground()
g_forceBuildBackgroundFromScratch = true;
}
- if (g_sprite[1].brain != 13)
+ if (g_sprite[1].brain != 13 || g_dglos.m_bRenderBackgroundOnLoad)
{
//brain 13 means mouse so we probably don't need this. Could be wrong though..
BuildScreenBackground(false);
diff --git a/source/dink/dink.h b/source/dink/dink.h
index 0346fb5..9e130f4 100644
--- a/source/dink/dink.h
+++ b/source/dink/dink.h
@@ -26,6 +26,8 @@ struct SpriteStruct;
#define FINISHED_LOADING 100
void ClearBitmapCopy();
+void ApplyAspectRatioGLMatrix();
+void RecomputeAspectRatio();
void CheckForHotkeys();
enum eDinkInput
@@ -104,6 +106,7 @@ public:
m_bLastFullKeyboardActive = false;
m_bSpeedUpMode = false;
m_bUsingDinkPak = false;
+ m_bForceControlsRebuild = false;
m_aspectRatioModX = 1.0f; //not the aspect ratio, the change to the aspect ratio so it's the correct aspect ratio. I know, it makes no sense
m_aspectRatioModY = 1.0f;
@@ -145,6 +148,7 @@ public:
bool m_bFullKeyboardActive;
bool m_bLastFullKeyboardActive;
bool m_bSpeedUpMode;
+ bool m_bForceControlsRebuild;
BackgroundSpriteManager m_bgSpriteMan;
bool m_bUsingDinkPak;
@@ -152,6 +156,7 @@ public:
float m_aspectRatioModY;
CL_Vec3f m_centeringOffset;
CL_Mat4f m_dink_matrix;
+ CL_Mat4f m_dink_matrix_inverted;
};
//#define KYLES_CRAZY_VERSION
@@ -735,6 +740,8 @@ bool DinkIsWaitingForSkippableDialog();
bool DinkSkipDialogLine(); //returns true if a line was actually skipped
void DinkSetCursorPosition(CL_Vec2f vPos);
CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos);
+CL_Vec2f DinkToNativeCoords(CL_Vec2f vPos);
+bool DinkIsMouseActive();
bool IsDrawingDinkStatusBar();
bool DinkSetInventoryPosition(CL_Vec2f vPos); //returns true if an item was actually set
bool DinkCanRunScriptNow();
diff --git a/windows_vs2017/winRTDink.vcxproj.user b/windows_vs2017/winRTDink.vcxproj.user
index f02a27c..f619236 100644
--- a/windows_vs2017/winRTDink.vcxproj.user
+++ b/windows_vs2017/winRTDink.vcxproj.user
@@ -7,7 +7,7 @@
$(OutDir)
WindowsLocalDebugger
- -game dmods/revolut
+ -game dmods/tdabeta