* 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

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1518 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-10-05 04:26:35 +00:00
parent 36a414e12a
commit 7e962c97e0
10 changed files with 183 additions and 124 deletions

View file

@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.8.6</string> <string>1.8.7</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.8.6</string> <string>1.8.7</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rtsoft.rtdink" package="com.rtsoft.rtdink"
android:versionCode="9" android:versionCode="9"
android:versionName="1.8.6" android:versionName="1.8.7"
android:installLocation="preferExternal" android:installLocation="preferExternal"
> >

View file

@ -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 * 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 - 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

View file

@ -184,8 +184,8 @@ App::App()
m_bDidPostInit = false; m_bDidPostInit = false;
m_bHasDMODSupport = true; m_bHasDMODSupport = true;
//for mobiles //for mobiles
m_version = 1.86f; m_version = 1.87f;
m_versionString = "V1.8.6"; m_versionString = "V1.8.7";
m_build = 1; m_build = 1;
m_bCheatsEnabled = false; m_bCheatsEnabled = false;
@ -802,7 +802,7 @@ void App::OnScreenSizeChange()
{ {
SetupOrtho(); SetupOrtho();
DinkOnForeground(); //rebuild lost surfaces DinkOnForeground(); //rebuild lost surfaces
g_dglo.m_bForceControlsRebuild = true;
if (GetDinkGameState() != DINK_GAME_STATE_PLAYING) if (GetDinkGameState() != DINK_GAME_STATE_PLAYING)
{ {
PrepareForGL(); PrepareForGL();

View file

@ -85,10 +85,12 @@ void CursorComponent::OnInput( VariantList *pVList )
if (!m_bDisable) if (!m_bDisable)
{ {
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_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
g_dinkMouseRightClick = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
g_dinkMouseRightClick = true;
}
} }
break; break;
@ -125,9 +127,12 @@ void CursorComponent::OnInput( VariantList *pVList )
if (!m_bDisable) if (!m_bDisable)
{ {
OnUpdatePos(pt); OnUpdatePos(pt);
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true; if (DinkIsMouseActive())
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true; {
g_dinkMouseRightClick = true; g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
g_dinkMouseRightClick = true;
}
} }

View file

@ -431,7 +431,20 @@ msg += \
"Brett Profitt\n"\ "Brett Profitt\n"\
"Chris Black\n"\ "Chris Black\n"\
"Erik Harrison\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) if (GetEmulatedPlatformID() == PLATFORM_ID_WINDOWS || GetEmulatedPlatformID() == PLATFORM_ID_IOS)
{ {

View file

@ -27,7 +27,6 @@ void UpdatePauseMenuPosition(Entity *pBG);
void ShowQuickMessage(string msg) void ShowQuickMessage(string msg)
{ {
Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu"); Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu");
//assert(pMenu); //assert(pMenu);
if (!pMenu) if (!pMenu)
@ -66,8 +65,6 @@ void ShowQuickMessageBottom(string msg)
void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{ {
Entity *pEntClicked = pVList->m_variant[1].GetEntity(); Entity *pEntClicked = pVList->m_variant[1].GetEntity();
Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu"); 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(); g_dglo.ToggleView();
return; return;
} }
if (pEntClicked->GetName() == "speedup") if (pEntClicked->GetName() == "speedup")
{ {
@ -316,9 +314,7 @@ void AddViewModeHotspot(Entity *pBG)
} }
CL_Vec2f vPos = pButtonEntity->GetVar("pos2d")->GetVector2(); CL_Vec2f vPos = pButtonEntity->GetVar("pos2d")->GetVector2();
CL_Vec2f vSize = pButtonEntity->GetVar("size2d")->GetVector2(); CL_Vec2f vSize = pButtonEntity->GetVar("size2d")->GetVector2();
if (GetApp()->GetVar("showViewHint")->GetUINT32() == 1) if (GetApp()->GetVar("showViewHint")->GetUINT32() == 1)
{ {
GetApp()->GetVar("showViewHint")->Set(uint32(0)); //so this won't be shown again 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"); Entity *pLabel = CreateTextLabelEntity(pOverlay, "label",vLabelPos.x, vLabelPos.y, "Tap here to toggle view");
SetAlignmentEntity(pLabel, ALIGNMENT_CENTER); SetAlignmentEntity(pLabel, ALIGNMENT_CENTER);
//fade them in //fade them in
FadeInEntity(pOverlay, true, 500, 1000); FadeInEntity(pOverlay, true, 500, 1000);
//fade them out //fade them out
@ -386,7 +381,6 @@ void AddSpeedUpButton(Entity *pBG)
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_LEFT); if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_LEFT);
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
SetAlphaEntity(pButtonEntity, GetApp()->GetVar("gui_transparency")->GetFloat()); SetAlphaEntity(pButtonEntity, GetApp()->GetVar("gui_transparency")->GetFloat());
//pButtonEntity->GetVar("alpha")->Set(trans); //pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect); pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
@ -413,11 +407,8 @@ void OnGameKillKeyboard(VariantList *pVList)
{ {
g_dglo.m_bFullKeyboardActive = false; g_dglo.m_bFullKeyboardActive = false;
//g_dglo.m_bLastFullKeyboardActive = false; //g_dglo.m_bLastFullKeyboardActive = false;
} }
void OnGameProcessHWKey(VariantList *pVList) void OnGameProcessHWKey(VariantList *pVList)
{ {
if (pVList->Get(0).GetFloat() != MESSAGE_TYPE_GUI_CHAR) return; if (pVList->Get(0).GetFloat() != MESSAGE_TYPE_GUI_CHAR) return;
@ -455,7 +446,6 @@ void OnGameProcessHWKey(VariantList *pVList)
void OnGameProcessKey(VariantList *pVList) void OnGameProcessKey(VariantList *pVList)
{ {
if (DinkCanRunScriptNow()) if (DinkCanRunScriptNow())
{ {
@ -572,8 +562,6 @@ void BuildInventoryControls(float fadeTimeMS)
SetTouchPaddingEntity(pButtonEntity, CL_Rectf(20,15,40,40)); SetTouchPaddingEntity(pButtonEntity, CL_Rectf(20,15,40,40));
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
} }
} }
void BuildShowingBMPControls(float fadeTimeMS) void BuildShowingBMPControls(float fadeTimeMS)
@ -603,7 +591,6 @@ void BuildShowingBMPControls(float fadeTimeMS)
} }
} }
void BuildControls(float fadeTimeMS) void BuildControls(float fadeTimeMS)
{ {
Entity *pBG = GetEntityRoot()->GetEntityByName("GameMenu"); Entity *pBG = GetEntityRoot()->GetEntityByName("GameMenu");
@ -622,49 +609,47 @@ void BuildControls(float fadeTimeMS)
float trans = 0.0f; float trans = 0.0f;
Entity *pButtonEntity; Entity *pButtonEntity;
if (GetApp()->GetUsingTouchScreen()) if (GetApp()->GetUsingTouchScreen())
{ {
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar()) if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar())
{
//not zoomed in
if (IsIPADSize)
{ {
iconX = FlipXIfNeeded(864); //not zoomed in
iconStartY = 120;
iconSpacerY = iPhoneMapY(72);
} else if (IsIphone4Size) if (IsIPADSize)
{ {
iconX = FlipXIfNeeded(820); iconX = FlipXIfNeeded(864);
iconStartY = 5; iconStartY = 120;
} iconSpacerY = iPhoneMapY(72);
} else } else if (IsIphone4Size)
{ {
//adjust for fullscreen view iconX = FlipXIfNeeded(820);
if (IsIPADSize) iconStartY = 5;
{ }
iconX = FlipXIfNeeded(890);
iconStartY = 100;
iconSpacerY = iPhoneMapY(72);
} else if (IsIphone4Size)
{
iconX = FlipXIfNeeded(820);
iconStartY = 5;
iconSpacerY = iPhoneMapY(76);
} else } else
{ {
//old iphone //adjust for fullscreen view
iconSpacerY = iPhoneMapY(76); if (IsIPADSize)
iconX = FlipXIfNeeded(iPhoneMapX(416)); {
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 //make the area where if you touch it the screen zoom will change
@ -673,6 +658,7 @@ float iconY = iconStartY;
//game icons //game icons
pButtonEntity = CreateOverlayButtonEntity(pBG, "inventory", ReplaceWithLargeInFileName("interface/iphone/button_inventory.rttex"), iconX, iconY); pButtonEntity = CreateOverlayButtonEntity(pBG, "inventory", ReplaceWithLargeInFileName("interface/iphone/button_inventory.rttex"), iconX, iconY);
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT); if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
pButtonEntity->GetVar("alpha")->Set(trans); pButtonEntity->GetVar("alpha")->Set(trans);
iconY += iconSpacerY; iconY += iconSpacerY;
@ -701,20 +687,35 @@ float iconY = iconStartY;
//pButtonEntity->GetComponentByName("Button2D")->GetVar("buttonStyle")->Set((uint32) Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH); //pButtonEntity->GetComponentByName("Button2D")->GetVar("buttonStyle")->Set((uint32) Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH);
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
pButtonEntity->GetParent()->MoveEntityToBottomByAddress(pButtonEntity); pButtonEntity->GetParent()->MoveEntityToBottomByAddress(pButtonEntity);
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED && IsDrawingDinkStatusBar()) 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->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect); pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect); pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
//I made this touchspot too big on purpose, easier to hit it. //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; iconY += iconSpacerY;
pButtonEntity->GetVar("alpha")->Set(trans); pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect); pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
@ -823,7 +824,7 @@ void BuildDialogModeControls(float fadeTimeMS)
pBG = pBG->AddEntity(new Entity("Controls")); 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; if (!GetApp()->GetUsingTouchScreen()) return;
@ -890,38 +891,47 @@ void BuildDialogModeControls(float fadeTimeMS)
if (!IsInFlingMode()) 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;
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
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); pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_down", ReplaceWithLargeInFileName("interface/iphone/button_arrow_down.rttex"), vDownArrowPos.x, vDownArrowPos.y);
pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity = CreateOverlayButtonEntity(pBG, "arrow_down", ReplaceWithLargeInFileName("interface/iphone/button_arrow_down.rttex"), vDownArrowPos.x, vDownArrowPos.y); pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect);
pButtonEntity->GetVar("alpha")->Set(trans); if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
pButtonEntity->GetShared()->GetFunction("OnOverStart")->sig_function.connect(&GameOnSelect); pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT); SetButtonClickSound(pButtonEntity, ""); //no sound
pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect); Entity * pDown = pButtonEntity;
SetButtonClickSound(pButtonEntity, ""); //no sound
Entity * pDown = pButtonEntity;
} }
pButtonEntity = CreateOverlayButtonEntity(pBG, "select", ReplaceWithLargeInFileName("interface/iphone/button_arrow_back.rttex"), vOkPos.x, vOkPos.y); pButtonEntity = CreateOverlayButtonEntity(pBG, "select", ReplaceWithLargeInFileName("interface/iphone/button_arrow_back.rttex"), vOkPos.x, vOkPos.y);
pButtonEntity->GetVar("alpha")->Set(trans); pButtonEntity->GetVar("alpha")->Set(trans);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&GameOnSelect); pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&GameOnSelect);
if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT); if (GetApp()->GetIconsOnLeft()) SetAlignmentEntity(pButtonEntity, ALIGNMENT_UPPER_RIGHT);
//pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect); //pButtonEntity->GetShared()->GetFunction("OnOverEnd")->sig_function.connect(&GameOnStopSelect);
//SetButtonStyleEntity(pButtonEntity, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH_RELEASE); //SetButtonStyleEntity(pButtonEntity, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH_RELEASE);
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
//SetButtonRepeatDelayMS(pButtonEntity, 1); //SetButtonRepeatDelayMS(pButtonEntity, 1);
Entity * pSelect = pButtonEntity; 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) if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED)
{ {
@ -936,6 +946,8 @@ void BuildDialogModeControls(float fadeTimeMS)
SetButtonClickSound(pButtonEntity, ""); //no sound SetButtonClickSound(pButtonEntity, ""); //no sound
} }
} }
pBG->MoveComponentToBottomByAddress(pCursor);
} }
void RecomputeAspectRatio(); void RecomputeAspectRatio();
@ -949,6 +961,7 @@ void UpdateControlsGUIIfNeeded()
|| g_dglo.m_lastActiveView != g_dglo.GetActiveView() || g_dglo.m_lastActiveView != g_dglo.GetActiveView()
|| g_dglo.m_lastIsUpdatingDinkStatusBar != IsDrawingDinkStatusBar() || g_dglo.m_lastIsUpdatingDinkStatusBar != IsDrawingDinkStatusBar()
|| g_dglo.m_bFullKeyboardActive != g_dglo.m_bLastFullKeyboardActive || 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 //don't care, leave the keyboard up
return; return;
} }
g_dglo.m_bForceControlsRebuild = false;
//kill any existing controls //kill any existing controls
KillControls(300); KillControls(300);
@ -971,7 +984,7 @@ void UpdateControlsGUIIfNeeded()
GetEntityRoot()->GetComponentByName("ArcadeInput")->GetVar("trackball_mode")->Set(uint32(ArcadeInputComponent::TRACKBALL_MODE_WALKING)); GetEntityRoot()->GetComponentByName("ArcadeInput")->GetVar("trackball_mode")->Set(uint32(ArcadeInputComponent::TRACKBALL_MODE_WALKING));
Entity *pMainMenu = GetEntityRoot()->GetEntityByName("GameMenu"); Entity *pMainMenu = GetEntityRoot()->GetEntityByName("GameMenu");
RecomputeAspectRatio(); //RecomputeAspectRatio();
AddSpeedUpButton(pMainMenu); AddSpeedUpButton(pMainMenu);
UpdatePauseMenuPosition(pMainMenu); UpdatePauseMenuPosition(pMainMenu);
@ -1018,11 +1031,9 @@ void ApplyAspectRatioGLMatrix();
void OnGameMenuRender(VariantList *pVList) void OnGameMenuRender(VariantList *pVList)
{ {
//apply matrix //apply matrix
glMatrixMode(GL_MODELVIEW); 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 //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) if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED)
@ -1051,15 +1062,12 @@ void OnGameMenuRender(VariantList *pVList)
} }
} }
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPopMatrix(); glPopMatrix();
//remove matrix //remove matrix
} }
void OnAutoSave(VariantList *pVList) void OnAutoSave(VariantList *pVList)
{ {
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING && DinkGetHealthPercent() > 0.3f) 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... //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); GetMessageManager()->CallEntityFunction(pVList->Get(0).GetEntity(), 5000, "OnAutoSave", pVList);
} }
void OnArcadeInput(VariantList *pVList) void OnArcadeInput(VariantList *pVList)
@ -1114,9 +1121,6 @@ void OnArcadeInput(VariantList *pVList)
{ {
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING) if (GetDinkGameState() == DINK_GAME_STATE_PLAYING)
{ {
string fName = DinkGetSavePath() + "quicksave.dat"; string fName = DinkGetSavePath() + "quicksave.dat";
if (FileExists(fName)) if (FileExists(fName))
@ -1135,6 +1139,7 @@ void OnArcadeInput(VariantList *pVList)
} }
} }
break; break;
case VIRTUAL_KEY_GAME_MAGIC: case VIRTUAL_KEY_GAME_MAGIC:
if (bIsDown) if (bIsDown)
@ -1150,10 +1155,8 @@ void OnArcadeInput(VariantList *pVList)
} else } else
{ {
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON3] = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON3] = true;
} }
break; break;
//EXAMINE //EXAMINE
case VIRTUAL_KEY_GAME_TALK: case VIRTUAL_KEY_GAME_TALK:
@ -1174,7 +1177,6 @@ void OnArcadeInput(VariantList *pVList)
} else } else
{ {
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON2] = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON2] = true;
} }
break; break;
@ -1186,7 +1188,6 @@ void OnArcadeInput(VariantList *pVList)
} else } else
{ {
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON4] = true; g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON4] = true;
} }
break; break;
@ -1242,10 +1243,7 @@ void OnRawCharInput(VariantList *pVList)
int vKey = pVList->Get(0).GetUINT32(); int vKey = pVList->Get(0).GetUINT32();
bool bIsDown = pVList->Get(1).GetUINT32() != 0; bool bIsDown = pVList->Get(1).GetUINT32() != 0;
//LogMsg("GameMenuRaw: Key %d, down is %d", vKey, int(bIsDown)); //LogMsg("GameMenuRaw: Key %d, down is %d", vKey, int(bIsDown));
} }
void UpdatePauseMenuPosition(Entity *pBG) void UpdatePauseMenuPosition(Entity *pBG)
@ -1394,6 +1392,7 @@ void GameLoadPiece(VariantList *pVList)
pBG->GetVar("didInit")->Set(uint32(1)); pBG->GetVar("didInit")->Set(uint32(1));
} }
if (progress == 1) if (progress == 1)
{ {
//we're done //we're done
@ -1436,7 +1435,6 @@ void GameLoadPiece(VariantList *pVList)
GetMessageManager()->CallEntityFunction(pBG, 1, "GameLoadPiece", &vList); GetMessageManager()->CallEntityFunction(pBG, 1, "GameLoadPiece", &vList);
return; return;
} }
} }
if (!LoadGameChunk(gameIdToLoad, progress)) if (!LoadGameChunk(gameIdToLoad, progress))
@ -1458,7 +1456,6 @@ Entity * GameCreate(Entity *pParentEnt, int gameIDToLoad, string stateToLoad, st
Entity *pBG = pParentEnt->AddEntity(new Entity("GameMenu")); Entity *pBG = pParentEnt->AddEntity(new Entity("GameMenu"));
AddFocusIfNeeded(pBG); AddFocusIfNeeded(pBG);
Entity *pLoading = CreateOverlayEntity(pBG, "game_loading", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0, 0); Entity *pLoading = CreateOverlayEntity(pBG, "game_loading", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0, 0);
//setup the splash too //setup the splash too
string splashBmp; string splashBmp;

View file

@ -9,6 +9,10 @@
#include "Renderer/SoftSurface.h" #include "Renderer/SoftSurface.h"
#include "FileSystem/StreamingInstance.h" #include "FileSystem/StreamingInstance.h"
#include <time.h> #include <time.h>
const int C_DINK_MAX_ITEMS = 16;
const int C_DINK_MAX_MAGICS = 8;
void ThinkSprite(int h, bool get_frame); void ThinkSprite(int h, bool get_frame);
void ApplyAspectRatioGLMatrix(); void ApplyAspectRatioGLMatrix();
@ -1348,7 +1352,7 @@ void kill_cur_item( void )
void kill_cur_item_script( char name[20]) void kill_cur_item_script( char name[20])
{ {
int select = 0; 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 (g_dglos.g_playerInfo.g_itemData[i].active)
if (compare(g_dglos.g_playerInfo.g_itemData[i].name, name)) 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 ) 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_smallMap.sprite[j].active)
if (g_dglos.g_playerInfo.spmap[*pmap].type[j] != 0) 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 //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) 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); LogMsg("Weapon/item %s added to inventory.",name);
g_dglos.g_playerInfo.g_itemData[i].seq = mseq; g_dglos.g_playerInfo.g_itemData[i].seq = mseq;
g_dglos.g_playerInfo.g_itemData[i].frame = mframe; 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; g_dglos.g_playerInfo.g_itemData[i].active = true;
//if (debug_mode) //if (debug_mode)
// LogMsg("wep: Checking seq",name); // 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); LogMsg("Magic %s added to inventory.",name);
g_dglos.g_playerInfo.g_MagicData[i].seq = mseq; g_dglos.g_playerInfo.g_MagicData[i].seq = mseq;
g_dglos.g_playerInfo.g_MagicData[i].frame = mframe; 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; g_dglos.g_playerInfo.g_MagicData[i].active = true;
//check_seq_status(mseq, mframe); //check_seq_status(mseq, mframe);
@ -7319,7 +7323,7 @@ pass:
if (compare(ev[1], (char*)"free_items")) if (compare(ev[1], (char*)"free_items"))
{ {
g_dglos.g_returnint = 0; 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) if (g_dglos.g_playerInfo.g_itemData[i].active == false)
{ {
@ -9433,7 +9437,7 @@ pass:
if (get_parms(ev[1], script, h, p)) if (get_parms(ev[1], script, h, p))
{ {
g_dglos.g_returnint = 0; 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) 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)) if (get_parms(ev[1], script, h, p))
{ {
g_dglos.g_returnint = 0; 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) 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) 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) 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].x = vPos.x;
g_sprite[1].y = vPos.y; 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 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 #ifdef _DEBUG
//LogMsg("Mouse diff: %.2f", difY); //LogMsg("Mouse diff: %.2f", difY);
#endif #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); 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) 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_lastGameMode = DINK_GAME_MODE_NONE;
g_dglo.m_lastSubGameMode = DINK_SUB_GAME_MODE_NONE; g_dglo.m_lastSubGameMode = DINK_SUB_GAME_MODE_NONE;
g_dglo.m_bFullKeyboardActive = false; g_dglo.m_bFullKeyboardActive = false;
g_dglo.m_bForceControlsRebuild = false;
g_dglo.m_bWaitingForSkippableConversation = false; g_dglo.m_bWaitingForSkippableConversation = false;
g_dglos.g_DinkUpdateTimerMS =0; g_dglos.g_DinkUpdateTimerMS =0;
@ -17690,8 +17719,8 @@ void ApplyAspectRatioGLMatrix()
glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0]); glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0]);
g_dglo.m_dink_matrix = mat; g_dglo.m_dink_matrix = mat;
//OPTIMIZE - All this can be cached... maybe done in RecomputeAspectRatio() //OPTIMIZE - All this can be cached... maybe done in RecomputeAspectRatio()
mat.inverse(); 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 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)); 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; 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.. //brain 13 means mouse so we probably don't need this. Could be wrong though..
BuildScreenBackground(false); BuildScreenBackground(false);

View file

@ -26,6 +26,8 @@ struct SpriteStruct;
#define FINISHED_LOADING 100 #define FINISHED_LOADING 100
void ClearBitmapCopy(); void ClearBitmapCopy();
void ApplyAspectRatioGLMatrix();
void RecomputeAspectRatio();
void CheckForHotkeys(); void CheckForHotkeys();
enum eDinkInput enum eDinkInput
@ -104,6 +106,7 @@ public:
m_bLastFullKeyboardActive = false; m_bLastFullKeyboardActive = false;
m_bSpeedUpMode = false; m_bSpeedUpMode = false;
m_bUsingDinkPak = 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_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; m_aspectRatioModY = 1.0f;
@ -145,6 +148,7 @@ public:
bool m_bFullKeyboardActive; bool m_bFullKeyboardActive;
bool m_bLastFullKeyboardActive; bool m_bLastFullKeyboardActive;
bool m_bSpeedUpMode; bool m_bSpeedUpMode;
bool m_bForceControlsRebuild;
BackgroundSpriteManager m_bgSpriteMan; BackgroundSpriteManager m_bgSpriteMan;
bool m_bUsingDinkPak; bool m_bUsingDinkPak;
@ -152,6 +156,7 @@ public:
float m_aspectRatioModY; float m_aspectRatioModY;
CL_Vec3f m_centeringOffset; CL_Vec3f m_centeringOffset;
CL_Mat4f m_dink_matrix; CL_Mat4f m_dink_matrix;
CL_Mat4f m_dink_matrix_inverted;
}; };
//#define KYLES_CRAZY_VERSION //#define KYLES_CRAZY_VERSION
@ -735,6 +740,8 @@ bool DinkIsWaitingForSkippableDialog();
bool DinkSkipDialogLine(); //returns true if a line was actually skipped bool DinkSkipDialogLine(); //returns true if a line was actually skipped
void DinkSetCursorPosition(CL_Vec2f vPos); void DinkSetCursorPosition(CL_Vec2f vPos);
CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos); CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos);
CL_Vec2f DinkToNativeCoords(CL_Vec2f vPos);
bool DinkIsMouseActive();
bool IsDrawingDinkStatusBar(); bool IsDrawingDinkStatusBar();
bool DinkSetInventoryPosition(CL_Vec2f vPos); //returns true if an item was actually set bool DinkSetInventoryPosition(CL_Vec2f vPos); //returns true if an item was actually set
bool DinkCanRunScriptNow(); bool DinkCanRunScriptNow();

View file

@ -7,7 +7,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug GL|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug GL|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-game dmods/revolut</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>-game dmods/tdabeta</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Common Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Common Debug|Win32'">
<LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>