* Changed "FPS lock:" to "Lock to 30 FPS:" in options, makes it more clear it's actually bad to use and not vsync

* (Windows) Handles alt-tab and clicking on a different monitor while in native fullscreen modes better
* Added "Ghost walk toggle" to in-game cheat menu.  Allows you to walk through solid objects and screenlocks
* (DinkC) Added support for Dan's load_tile() command
* Some junk removed from the debug log

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1482 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-09-15 14:10:37 +00:00
parent e0717ae8d1
commit ba5fb5abbf
18 changed files with 665 additions and 603 deletions

View file

@ -80,3 +80,9 @@ www.rtsoft.com
* Added redink1's "soft shadow improvement" patch
* (proton) Fixed issue with blitting alpha things to the background, fixed the soft shadows for things rendered into the background
------ Change log for 1.7.2 ----------
* Changed "FPS lock:" to "Lock to 30 FPS:" in options, makes it more clear it's actually bad to use and not vsync
* (Windows) Handles alt-tab and clicking on a different monitor while in native fullscreen modes better
* Added "Ghost walk toggle" to in-game cheat menu. Allows you to walk through solid objects and screenlocks
* (DinkC) Added support for Dan's load_tile() command

View file

@ -172,7 +172,7 @@ App::App()
{
http://www.rtsoft.com
m_bGhostMode = false;
#ifdef ANDROID_NDK
SetPreferSDCardForStorage(true);
#endif
@ -180,8 +180,8 @@ App::App()
m_bDidPostInit = false;
m_bHasDMODSupport = true;
//for mobiles
m_version = 1.71f;
m_versionString = "V1.7.1";
m_version = 1.72f;
m_versionString = "V1.7.2";
m_build = 1;
m_bCheatsEnabled = false;

View file

@ -83,6 +83,8 @@ public:
void RemoveAndroidKeyboardKeys();
void AddIcadeProvider();
bool GetForceAspectRatio();
bool GetGhostMode() {return m_bGhostMode;}
void SetGhostMode(bool bNew) { m_bGhostMode = bNew; }
private:
@ -93,6 +95,7 @@ private:
int m_special;
bool m_bUsingTouchScreen;
bool m_bForceAspectRatio;
bool m_bGhostMode; //lets dink walk anywhere and ignore screenlocks
void SaveAllData();
void OnPreEnterBackground(VariantList *pVList);

View file

@ -139,7 +139,7 @@ void AboutMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity se
}
*/
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
void AddBlurb(Entity* pParent, float x, float y, string fileName, string msg)

View file

@ -74,7 +74,7 @@ void BrowseMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity s
}
*/
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}

View file

@ -44,7 +44,7 @@ void DMODInstallMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=ent
}
GetEntityRoot()->PrintTreeAsText(); //useful for Loading
//GetEntityRoot()->PrintTreeAsText(); //useful for Loading
}
void DMODInstallUpdateStatus(Entity *pMenu, string msg)

View file

@ -156,7 +156,7 @@ void DMODMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sen
}
*/
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
CL_Vec2f GetDMODBarIconOffset()

View file

@ -1,108 +1,124 @@
#include "PlatformPrecomp.h"
#include "DebugMenu.h"
#include "Entity/EntityUtils.h"
#include "dink/dink.h"
#include "LogMenu.h"
void DebugMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
if (pEntClicked->GetName() == "FPS")
{
GetBaseApp()->SetFPSVisible(!GetBaseApp()->GetFPSVisible());
}
if (pEntClicked->GetName() == "music_on")
{
GetAudioManager()->Play("audio/intro.ogg", true, true);
}
if (pEntClicked->GetName() == "music_off")
{
GetAudioManager()->StopMusic();
}
if (pEntClicked->GetName() == "log")
{
RemoveFocusIfNeeded(pEntClicked->GetParent());
SlideScreen(pEntClicked->GetParent(), false);
LogMenuCreate(pEntClicked->GetParent()->GetParent());
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
}
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
RemoveFocusIfNeeded(pEntClicked->GetParent());
SlideScreen(pEntClicked->GetParent(), false);
AddFocusIfNeeded(pEntClicked->GetParent()->GetParent());
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
}
if (pEntClicked->GetName() == "AddStrength")
{
//slide it off the screen and then kill the whole menu tree
DinkModStrength(1);
}
if (pEntClicked->GetName() == "AddDefense")
{
//slide it off the screen and then kill the whole menu tree
DinkModDefense(1);
}
if (pEntClicked->GetName() == "AddMagic")
{
//slide it off the screen and then kill the whole menu tree
DinkModMagic(1);
}
if (pEntClicked->GetName() == "AddLife")
{
//slide it off the screen and then kill the whole menu tree
DinkModLifeMax(10);
}
if (pEntClicked->GetName() == "FillLife")
{
//slide it off the screen and then kill the whole menu tree
DinkFillLife();
}
if (pEntClicked->GetName() == "AddGold")
{
//slide it off the screen and then kill the whole menu tree
DinkModGold(100);
}
if (pEntClicked->GetName() == "empty_cache")
{
DinkUnloadGraphicsCache();
LogMsg("Cache emptied");
}
if (pEntClicked->GetName() == "AddBow")
{
//slide it off the screen and then kill the whole menu tree
DinkAddBow();
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
Entity * DebugMenuCreate(Entity *pParentEnt)
{
//Entity *pBG = CreateOverlayEntity(pParentEnt, "DebugMenu", "interface/generic_bg.rttex", 0,0);
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
AddFocusIfNeeded(pBG);
#include "Entity/EntityUtils.h"
#include "dink/dink.h"
#include "LogMenu.h"
#include "GameMenu.h"
void DebugMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
if (pEntClicked->GetName() == "FPS")
{
GetBaseApp()->SetFPSVisible(!GetBaseApp()->GetFPSVisible());
}
if (pEntClicked->GetName() == "music_on")
{
GetAudioManager()->Play("audio/intro.ogg", true, true);
}
if (pEntClicked->GetName() == "music_off")
{
GetAudioManager()->StopMusic();
}
if (pEntClicked->GetName() == "log")
{
RemoveFocusIfNeeded(pEntClicked->GetParent());
SlideScreen(pEntClicked->GetParent(), false);
LogMenuCreate(pEntClicked->GetParent()->GetParent());
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
}
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
RemoveFocusIfNeeded(pEntClicked->GetParent());
SlideScreen(pEntClicked->GetParent(), false);
AddFocusIfNeeded(pEntClicked->GetParent()->GetParent());
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
}
if (pEntClicked->GetName() == "AddStrength")
{
//slide it off the screen and then kill the whole menu tree
DinkModStrength(1);
}
if (pEntClicked->GetName() == "AddDefense")
{
//slide it off the screen and then kill the whole menu tree
DinkModDefense(1);
}
if (pEntClicked->GetName() == "AddMagic")
{
//slide it off the screen and then kill the whole menu tree
DinkModMagic(1);
}
if (pEntClicked->GetName() == "AddLife")
{
//slide it off the screen and then kill the whole menu tree
DinkModLifeMax(10);
}
if (pEntClicked->GetName() == "FillLife")
{
//slide it off the screen and then kill the whole menu tree
DinkFillLife();
}
if (pEntClicked->GetName() == "AddGold")
{
//slide it off the screen and then kill the whole menu tree
DinkModGold(100);
}
if (pEntClicked->GetName() == "ghost_walk")
{
GetApp()->SetGhostMode(!GetApp()->GetGhostMode());
if (GetApp()->GetGhostMode())
{
ShowQuickMessage("Ghost walk enabled - can walk through hardness and screenlocks");
}
else
{
ShowQuickMessage("Ghost walk disabled");
}
}
if (pEntClicked->GetName() == "empty_cache")
{
DinkUnloadGraphicsCache();
LogMsg("Cache emptied");
}
if (pEntClicked->GetName() == "AddBow")
{
//slide it off the screen and then kill the whole menu tree
DinkAddBow();
}
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
Entity * DebugMenuCreate(Entity *pParentEnt)
{
//Entity *pBG = CreateOverlayEntity(pParentEnt, "DebugMenu", "interface/generic_bg.rttex", 0,0);
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
AddFocusIfNeeded(pBG);
Entity *pButtonEntity;
float x = iPhoneMapX(30);
@ -110,54 +126,57 @@ Entity * DebugMenuCreate(Entity *pParentEnt)
float ySpacer = iPhoneMapY(40);
pButtonEntity = CreateTextButtonEntity(pBG, "FPS", x, y, "Toggle FPS Display"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
if (GetApp()->GetCheatsEnabled())
{
if (GetApp()->GetCheatsEnabled())
{
pButtonEntity = CreateTextButtonEntity(pBG, "empty_cache", x, y, "Empty graphic cache"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
}
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "ghost_walk", x, y, "Ghost walk toggle"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
}
pButtonEntity = CreateTextButtonEntity(pBG, "log", x, y, "View log"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "Back", x, y, "Back"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
if (GetApp()->GetCheatsEnabled())
if (GetApp()->GetCheatsEnabled())
{
//buttons on right
x = iPhoneMapX(200);
y = iPhoneMapY(30);
pButtonEntity = CreateTextButtonEntity(pBG, "AddStrength", x, y, "Increase Strength"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "AddDefense", x, y, "Increase Defense"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "AddMagic", x, y, "Increase Magic"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "AddLife", x, y, "Increase Life"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "FillLife", x, y, "Refill Life"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "AddGold", x, y, "Add 100 Gold"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity = CreateTextButtonEntity(pBG, "AddBow", x, y, "Add Bow"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DebugMenuOnSelect);
}
SlideScreen(pBG, true, 500);
return pBG;
}
return pBG;
}

View file

@ -163,7 +163,7 @@ void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent fr
return;
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
void GameOnStopSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
@ -203,7 +203,7 @@ void GameOnStopSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sen
return;
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}

View file

@ -1,62 +1,62 @@
#include "PlatformPrecomp.h"
#include "LoadMenu.h"
#include "Entity/EntityUtils.h"
#include "MainMenu.h"
#include "dink/dink.h"
#include "GameMenu.h"
#define C_SAVE_GAME_COUNT 10
void LoadMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
MainMenuCreate(pEntClicked->GetParent()->GetParent());
//LoadMenuCreate(GetParent()
}
int num = atol(pEntClicked->GetName().c_str());
if (num > 0)
{
//let's load this sucka
#include "Entity/EntityUtils.h"
#include "MainMenu.h"
#include "dink/dink.h"
#include "GameMenu.h"
#define C_SAVE_GAME_COUNT 10
void LoadMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
MainMenuCreate(pEntClicked->GetParent()->GetParent());
//LoadMenuCreate(GetParent()
}
int num = atol(pEntClicked->GetName().c_str());
if (num > 0)
{
//let's load this sucka
DisableAllButtonsEntity(pEntClicked->GetParent());
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
if (num == 10)
{
string fName = GetSavePath()+"dink/"+"autosave.dat";
GameCreate(pEntClicked->GetParent()->GetParent(), 0, fName);
GameCreate(pEntClicked->GetParent()->GetParent(), 0, fName);
} else
{
GameCreate(pEntClicked->GetParent()->GetParent(), num, "");
}
}
GetEntityRoot()->PrintTreeAsText(); //useful for Loading
}
void SetupLoadButton(Entity *pParent, int x, float *pY, int gameID)
{
gameID++; //it's 1 based, not 0 based
const float ySpacer = 46;
if (gameID > 5) x += 200;
char stTemp[256];
char stFormatted[256];
string clickKey = ""; //none
int gameTime;
} else
{
GameCreate(pEntClicked->GetParent()->GetParent(), num, "");
}
}
//GetEntityRoot()->PrintTreeAsText(); //useful for Loading
}
void SetupLoadButton(Entity *pParent, int x, float *pY, int gameID)
{
gameID++; //it's 1 based, not 0 based
const float ySpacer = 46;
if (gameID > 5) x += 200;
char stTemp[256];
char stFormatted[256];
string clickKey = ""; //none
int gameTime;
if (gameID == 10)
{
string autoSave = DinkGetSavePath() + "autosave.dat";
@ -82,27 +82,27 @@ void SetupLoadButton(Entity *pParent, int x, float *pY, int gameID)
sprintf(stFormatted, "Auto Save - %d:%02d - %s", (gameTime / 60), gameTime - ((gameTime / 60) * 60), description.c_str());
clickKey = toString(gameID);
}
} else
if (load_game_small(gameID, stTemp, &gameTime))
{
} else
if (load_game_small(gameID, stTemp, &gameTime))
{
sprintf(stFormatted, "Slot %d - %d:%02d - %s", gameID, (gameTime / 60), gameTime - ((gameTime / 60) * 60) , stTemp);
clickKey = toString(gameID);
} else
{
sprintf(stFormatted, "Slot %d - Empty", gameID);
}
string butText = stFormatted;
} else
{
sprintf(stFormatted, "Slot %d - Empty", gameID);
}
string butText = stFormatted;
Entity * pButtonEntity = CreateTextButtonEntity(pParent, clickKey, iPhoneMapX(x), iPhoneMapY(*pY), butText, false); *pY += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LoadMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LoadMenuOnSelect);
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
}
Entity * LoadMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "LoadMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
AddFocusIfNeeded(pBG, true);
}
Entity * LoadMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "LoadMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
AddFocusIfNeeded(pBG, true);
Entity *pButtonEntity;
float x = 80;
@ -116,12 +116,12 @@ Entity * LoadMenuCreate(Entity *pParentEnt)
SetupLoadButton(pBG, x, &y, i);
}
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(x), iPhoneMapY(y), "Back"); y += ySpacer;
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LoadMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LoadMenuOnSelect);
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
SlideScreen(pBG, true, 500);
return pBG;
}
return pBG;
}

View file

@ -1,98 +1,98 @@
#include "PlatformPrecomp.h"
#include "LogMenu.h"
#include "Entity/EntityUtils.h"
#include "dink/dink.h"
#include "MainMenu.h"
void LogEnd(Entity *pMenu)
{
//slide it off the screen and then kill the whole menu tree
RemoveFocusIfNeeded(pMenu);
//SlideScreen(pEntClicked->GetParent(), false);
AddFocusIfNeeded(pMenu->GetParent());
FadeOutEntity(pMenu, true, 499);
GetMessageManager()->CallEntityFunction(pMenu, 500, "OnDelete", NULL);
}
void LogMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
Entity *pMenu = GetEntityRoot()->GetEntityByName("LogMenu");
if (pEntClicked->GetName() == "Back")
{
LogEnd(pMenu);
}
GetEntityRoot()->PrintTreeAsText(); //useful for Log
}
void LogAddScrollContent(Entity *pParent)
{
pParent = pParent->GetEntityByName("scroll_child");
float x = iPhoneMapX(5);
float y = 0;
CL_Vec2f vTextBoxPos(iPhoneMapX(20),y);
CL_Vec2f vTextBounds(iPhoneMapX(434), iPhoneMapY(200));
string msg = GetBaseApp()->GetConsole()->GetAsSingleString();
CreateTextBoxEntity(pParent, "", vTextBoxPos, vTextBounds, msg, 0.7f);
VariantList vList(pParent->GetParent());
ResizeScrollBounds(&vList);
}
Entity * LogMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
pBG->SetName("LogMenu");
AddFocusIfNeeded(pBG, true);
Entity *pButtonEntity;
//setup a scrolling window
CL_Vec2f vTextAreaPos = CL_Vec2f(0,0);
float offsetFromBottom = iPhoneMapY(30);
CL_Vec2f vTextAreaBounds = GetScreenSize()-CL_Vec2f(15,offsetFromBottom);
Entity *pScroll = pBG->AddEntity(new Entity("scroll"));
pScroll->GetVar("size2d")->Set(vTextAreaBounds);
pScroll->AddComponent(new TouchHandlerComponent);
EntityComponent *pFilter = pScroll->AddComponent(new FilterInputComponent);
EntityComponent *pScrollComp = pScroll->AddComponent(new ScrollComponent);
EntityComponent *pScrollBarComp = pScroll->AddComponent(new ScrollBarRenderComponent); //also let's add a visual way to see the scroller position
pScroll->GetVar("color")->Set(MAKE_RGBA(61,155, 193, 255));
Entity *pScrollChild = pScroll->AddEntity(new Entity("scroll_child"));
#include "PlatformPrecomp.h"
#include "LogMenu.h"
#include "Entity/EntityUtils.h"
#include "dink/dink.h"
#include "MainMenu.h"
void LogEnd(Entity *pMenu)
{
//slide it off the screen and then kill the whole menu tree
RemoveFocusIfNeeded(pMenu);
//SlideScreen(pEntClicked->GetParent(), false);
AddFocusIfNeeded(pMenu->GetParent());
FadeOutEntity(pMenu, true, 499);
GetMessageManager()->CallEntityFunction(pMenu, 500, "OnDelete", NULL);
}
void LogMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
Entity *pMenu = GetEntityRoot()->GetEntityByName("LogMenu");
if (pEntClicked->GetName() == "Back")
{
LogEnd(pMenu);
}
//GetEntityRoot()->PrintTreeAsText(); //useful for Log
}
void LogAddScrollContent(Entity *pParent)
{
pParent = pParent->GetEntityByName("scroll_child");
float x = iPhoneMapX(5);
float y = 0;
CL_Vec2f vTextBoxPos(iPhoneMapX(20),y);
CL_Vec2f vTextBounds(iPhoneMapX(434), iPhoneMapY(200));
string msg = GetBaseApp()->GetConsole()->GetAsSingleString();
CreateTextBoxEntity(pParent, "", vTextBoxPos, vTextBounds, msg, 0.7f);
VariantList vList(pParent->GetParent());
ResizeScrollBounds(&vList);
}
Entity * LogMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
pBG->SetName("LogMenu");
AddFocusIfNeeded(pBG, true);
Entity *pButtonEntity;
//setup a scrolling window
CL_Vec2f vTextAreaPos = CL_Vec2f(0,0);
float offsetFromBottom = iPhoneMapY(30);
CL_Vec2f vTextAreaBounds = GetScreenSize()-CL_Vec2f(15,offsetFromBottom);
Entity *pScroll = pBG->AddEntity(new Entity("scroll"));
pScroll->GetVar("size2d")->Set(vTextAreaBounds);
pScroll->AddComponent(new TouchHandlerComponent);
EntityComponent *pFilter = pScroll->AddComponent(new FilterInputComponent);
EntityComponent *pScrollComp = pScroll->AddComponent(new ScrollComponent);
EntityComponent *pScrollBarComp = pScroll->AddComponent(new ScrollBarRenderComponent); //also let's add a visual way to see the scroller position
pScroll->GetVar("color")->Set(MAKE_RGBA(61,155, 193, 255));
Entity *pScrollChild = pScroll->AddEntity(new Entity("scroll_child"));
pScrollComp->GetVar("fingerTracking")->Set(uint32(1));
EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
//Entity *pOverlay = CreateOverlayEntity(pBG, "", ReplaceWithDeviceNameInFileName("interface/iphone/bg_stone_overlay.rttex"), 0, GetScreenSizeYf());
//SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
LogAddScrollContent(pBG);
VariantList vList(CL_Vec2f(0.0f, 1.0f));
pScrollComp->GetFunction("SetProgress")->sig_function(&vList); //scroll to the end
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(35), iPhoneMapY(300), "CONTINUE", false);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LogMenuOnSelect);
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
FadeInEntity(pBG, true);
return pBG;
}
EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
//Entity *pOverlay = CreateOverlayEntity(pBG, "", ReplaceWithDeviceNameInFileName("interface/iphone/bg_stone_overlay.rttex"), 0, GetScreenSizeYf());
//SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
LogAddScrollContent(pBG);
VariantList vList(CL_Vec2f(0.0f, 1.0f));
pScrollComp->GetFunction("SetProgress")->sig_function(&vList); //scroll to the end
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(35), iPhoneMapY(300), "CONTINUE", false);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LogMenuOnSelect);
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
FadeInEntity(pBG, true);
return pBG;
}

View file

@ -279,7 +279,7 @@ void OptionsMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
return;
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
@ -479,7 +479,7 @@ void OptionsMenuAddScrollContent(Entity *pParent)
//fps limit
pEnt = CreateTextLabelEntity(pBG, "", startX, y, "FPS lock:");
pEnt = CreateTextLabelEntity(pBG, "", startX, y, "Lock to 30 FPS:");
SetupTextEntity(pEnt,fontID);
offsetX = iPhoneMapX(columnX);
pEnt = CreateTextButtonEntity(pBG, "fps_limit_0", offsetX, y, "On", false);

View file

@ -232,7 +232,7 @@ void PauseMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity se
}
GetEntityRoot()->PrintTreeAsText(); //useful for Pause
//GetEntityRoot()->PrintTreeAsText(); //useful for Pause
}

View file

@ -1,251 +1,251 @@
#include "PlatformPrecomp.h"
#include "PopUpMenu.h"
#include "Entity/EntityUtils.h"
#include "App.h"
Entity * PopUpRestoreFocusToOriginalMenu(Entity *pEntClicked)
{
Entity *pFinishMenu = GetEntityRoot()->GetEntityByName(pEntClicked->GetParent()->GetParent()->GetVar("finishMenuName")->GetString());
assert(pFinishMenu);
if (pFinishMenu)
{
if (pEntClicked->GetParent()->GetParent()->GetVar("requireMoveMessages")->GetUINT32() == 1)
{
AddFocusIfNeeded(pFinishMenu, true, 0);
} else
{
pFinishMenu->AddComponent(new FocusInputComponent);
}
}
return pFinishMenu;
}
void ReloadMainMenu(VariantList *pVList);
//general purpose pop up menu, I've hardcoded various behaviors here, it knows what to do based on the button name
void PopUpMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
FadeOutEntity(pEntClicked->GetParent()->GetParent(), true, 300);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent()->GetParent(), 500, "OnDelete", NULL);
DisableAllButtonsEntity(pEntClicked->GetParent()->GetParent());
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
FadeScreen(pDarken, 0, 0, 400, true);
KillEntity(pDarken, 400);
pDarken->SetName("");
//set the game pause state back to whatever it was originally
GetApp()->SetGameTickPause(pEntClicked->GetParent()->GetParent()->GetVar("gamePaused")->GetUINT32() != 0);
if (pEntClicked->GetName() == "url")
{
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
LaunchURL(pEntClicked->GetVar("url")->GetString());
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
} else if (pEntClicked->GetName() == "url_update")
{
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
LaunchURL(pEntClicked->GetVar("url")->GetString());
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//kill current menu
//GetMessageManager()->CallEntityFunction(pFinishMenu, 200, "OnDelete", NULL);
PopUpCreate(pFinishMenu, "Please close the game and install the new version!", "", "cancel", "", "", "", true);
}
else
/*
if (pEntClicked->GetName() == "music_disable")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetApp()->GetShared()->GetVar("musicDisabled")->Set(uint32(1));
GetAudioManager()->SetMusicEnabled(false);
string msg = "Music disabled. You can re-enable it from the `wOptions`` menu later.";
PopUpCreate(pFinishMenu, msg, "", "cancel", "Continue", "", "", true);
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true); //because music is disabled this won't play, but it will remember this if
//we enable music again so we still want it
} else
if (pEntClicked->GetName() == "music_on")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true);
} else
if (pEntClicked->GetName() == "quit_game")
{
Entity *pGameMenu = GetEntityRoot()->GetEntityByName("GameMenu");
//GetApp()->SetGameType(GAME_TYPE_NONE);
//slide it off the screen and then kill the whole menu tree
SlideScreen(pGameMenu, false, 500, 10);
GetMessageManager()->CallEntityFunction(pGameMenu, 900, "OnDelete", NULL);
//SummaryMenuCreate(pGameMenu->GetParent());
GetBaseApp()->SetGameTickPause(false);
} else
*/
if (pEntClicked->GetName() == "cancel")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
}if (pEntClicked->GetName() == "cancel_update")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//kill current menu
GetMessageManager()->CallEntityFunction(pFinishMenu, 100, "OnDelete", NULL);
#include "PlatformPrecomp.h"
#include "PopUpMenu.h"
#include "Entity/EntityUtils.h"
#include "App.h"
Entity * PopUpRestoreFocusToOriginalMenu(Entity *pEntClicked)
{
Entity *pFinishMenu = GetEntityRoot()->GetEntityByName(pEntClicked->GetParent()->GetParent()->GetVar("finishMenuName")->GetString());
assert(pFinishMenu);
if (pFinishMenu)
{
if (pEntClicked->GetParent()->GetParent()->GetVar("requireMoveMessages")->GetUINT32() == 1)
{
AddFocusIfNeeded(pFinishMenu, true, 0);
} else
{
pFinishMenu->AddComponent(new FocusInputComponent);
}
}
return pFinishMenu;
}
void ReloadMainMenu(VariantList *pVList);
//general purpose pop up menu, I've hardcoded various behaviors here, it knows what to do based on the button name
void PopUpMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
FadeOutEntity(pEntClicked->GetParent()->GetParent(), true, 300);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent()->GetParent(), 500, "OnDelete", NULL);
DisableAllButtonsEntity(pEntClicked->GetParent()->GetParent());
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
FadeScreen(pDarken, 0, 0, 400, true);
KillEntity(pDarken, 400);
pDarken->SetName("");
//set the game pause state back to whatever it was originally
GetApp()->SetGameTickPause(pEntClicked->GetParent()->GetParent()->GetVar("gamePaused")->GetUINT32() != 0);
if (pEntClicked->GetName() == "url")
{
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
LaunchURL(pEntClicked->GetVar("url")->GetString());
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
} else if (pEntClicked->GetName() == "url_update")
{
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
LaunchURL(pEntClicked->GetVar("url")->GetString());
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//kill current menu
//GetMessageManager()->CallEntityFunction(pFinishMenu, 200, "OnDelete", NULL);
PopUpCreate(pFinishMenu, "Please close the game and install the new version!", "", "cancel", "", "", "", true);
}
else
/*
if (pEntClicked->GetName() == "music_disable")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetApp()->GetShared()->GetVar("musicDisabled")->Set(uint32(1));
GetAudioManager()->SetMusicEnabled(false);
string msg = "Music disabled. You can re-enable it from the `wOptions`` menu later.";
PopUpCreate(pFinishMenu, msg, "", "cancel", "Continue", "", "", true);
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true); //because music is disabled this won't play, but it will remember this if
//we enable music again so we still want it
} else
if (pEntClicked->GetName() == "music_on")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true);
} else
if (pEntClicked->GetName() == "quit_game")
{
Entity *pGameMenu = GetEntityRoot()->GetEntityByName("GameMenu");
//GetApp()->SetGameType(GAME_TYPE_NONE);
//slide it off the screen and then kill the whole menu tree
SlideScreen(pGameMenu, false, 500, 10);
GetMessageManager()->CallEntityFunction(pGameMenu, 900, "OnDelete", NULL);
//SummaryMenuCreate(pGameMenu->GetParent());
GetBaseApp()->SetGameTickPause(false);
} else
*/
if (pEntClicked->GetName() == "cancel")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
}if (pEntClicked->GetName() == "cancel_update")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//kill current menu
GetMessageManager()->CallEntityFunction(pFinishMenu, 100, "OnDelete", NULL);
VariantList vList(pFinishMenu->GetParent());
GetMessageManager()->CallStaticFunction(ReloadMainMenu, 200, &vList, TIMER_SYSTEM);
}
else
if (pEntClicked->GetName() == "reset")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetAudioManager()->Play("audio/tip_start.wav");
//GetHighScoreManager()->ResetLocalScores();
//belay that order, show another pop up...
PopUpCreate(pFinishMenu, "Local high scores have been reset.", "", "cancel", "Continue", "", "", true);
} else
{
//unhandled
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//call this function on the original guy, just in case they want to do something with it
VariantList vList(pFinishMenu, pEntClicked->GetName());
pFinishMenu->GetFunction(pEntClicked->GetName())->sig_function(&vList);
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
void PopUpCreate(Entity *pEnt, string msg, string url, string button1Action, string button1Label, string button2Action, string button2Label,
bool bRequireMoveMessages, string button3Action, string button3Label)
{
pEnt->RemoveComponentByName("FocusInput");
bool bGamePaused = GetBaseApp()->GetGameTickPause();
GetBaseApp()->SetGameTickPause(true);
// GetMessageManager()->RemoveComponentByName(pEnt, 201, "FocusInput"); //hack that works around a problem of pending FocusInput messages coming in
//remember where we should give focus to later
string parentName = pEnt->GetName();
assert(!parentName.empty());
//let's build our own menu right on the GUI branch of the tree
pEnt = GetEntityRoot()->GetEntityByName("GUI");
Entity *pDarken = pEnt->AddEntity(new Entity("pop_up_darken"));
pDarken->AddComponent(new FocusRenderComponent);
pDarken->AddComponent(new FocusUpdateComponent);
FadeScreen(pDarken, 0, 0.7, 400, false); //fade the whole GUI
//add our prompt
Entity *pBG = CreateOverlayEntity(pEnt, "pop_up", ReplaceWithLargeInFileName("interface/iphone/pop_up.rttex"), 0,0);
//Ok, at this point we can check the image dimensions and center it based on the bitmap size itself
pBG->GetVar("pos2d")->Set( (GetScreenSize()/2) - pBG->GetVar("size2d")->GetVector2()/2);
// pBG->AddComponent(new FocusInputComponent);
pBG->GetVar("finishMenuName")->Set(parentName);
if (bRequireMoveMessages)
{
pBG->GetVar("requireMoveMessages")->Set(uint32(1));
}
AddFocusIfNeeded(pBG);
CL_Vec2f vTextArea = pBG->GetVar("size2d")->GetVector2();
float padding = 30;
vTextArea.x -= iPhoneMapX2X(padding*2);
//add our msg and word wrap it
Entity *pText = CreateTextBoxEntity(pBG, "pop_up_text", (pBG->GetVar("size2d")->GetVector2()/2)+CL_Vec2f(0, iPhoneMapY2X(-17)), vTextArea, msg);
SetAlignmentEntity(pText, ALIGNMENT_CENTER);
float textHeight = pText->GetVar("size2d")->GetVector2().y;
FadeInEntity(pBG, true, 300);
//pText->GetVar("color")->Set(MAKE_RGBA(203,177,137,255));
pBG->GetVar("gamePaused")->Set(uint32(bGamePaused != 0)); //remember this for later
Entity *pButton = NULL;
CL_Vec2f vButtonSize;
Entity *pLabel;
Entity *pButton1, *pButton2;
float buttonHeight = iPhoneMapY2X(120);
if (textHeight > iPhoneMapY2X(50))
{
//well, we need more space for this much text. Move the buttons down a bit.
buttonHeight = iPhoneMapY2X(135);
}
//add the buttons
pButton = CreateOverlayEntity(pBG, "button1", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(21), buttonHeight);
pButton1 = pButton;
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button1Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button1Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 250);
if (button2Label.empty())
{
//we only have one button? Fine, center it.
pButton->GetVar("pos2d")->Set(iPhoneMapX(88), buttonHeight);
} else
{
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapY2X(180), buttonHeight);
pButton2 = pButton;
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button2Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button2Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 350);
if (button3Label.empty())
{
//we only have two buttons? fine. Done then
} else
{
pButton1->GetVar("pos2d")->Set(iPhoneMapX2X(20), buttonHeight);
pButton2->GetVar("pos2d")->Set(iPhoneMapX2X(180), buttonHeight);
//move stuff around and add a third button
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(100), buttonHeight);
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button3Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button3Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 450);
}
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
GetMessageManager()->CallStaticFunction(ReloadMainMenu, 200, &vList, TIMER_SYSTEM);
}
else
if (pEntClicked->GetName() == "reset")
{
//add control back
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
GetAudioManager()->Play("audio/tip_start.wav");
//GetHighScoreManager()->ResetLocalScores();
//belay that order, show another pop up...
PopUpCreate(pFinishMenu, "Local high scores have been reset.", "", "cancel", "Continue", "", "", true);
} else
{
//unhandled
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
//call this function on the original guy, just in case they want to do something with it
VariantList vList(pFinishMenu, pEntClicked->GetName());
pFinishMenu->GetFunction(pEntClicked->GetName())->sig_function(&vList);
}
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}
void PopUpCreate(Entity *pEnt, string msg, string url, string button1Action, string button1Label, string button2Action, string button2Label,
bool bRequireMoveMessages, string button3Action, string button3Label)
{
pEnt->RemoveComponentByName("FocusInput");
bool bGamePaused = GetBaseApp()->GetGameTickPause();
GetBaseApp()->SetGameTickPause(true);
// GetMessageManager()->RemoveComponentByName(pEnt, 201, "FocusInput"); //hack that works around a problem of pending FocusInput messages coming in
//remember where we should give focus to later
string parentName = pEnt->GetName();
assert(!parentName.empty());
//let's build our own menu right on the GUI branch of the tree
pEnt = GetEntityRoot()->GetEntityByName("GUI");
Entity *pDarken = pEnt->AddEntity(new Entity("pop_up_darken"));
pDarken->AddComponent(new FocusRenderComponent);
pDarken->AddComponent(new FocusUpdateComponent);
FadeScreen(pDarken, 0, 0.7, 400, false); //fade the whole GUI
//add our prompt
Entity *pBG = CreateOverlayEntity(pEnt, "pop_up", ReplaceWithLargeInFileName("interface/iphone/pop_up.rttex"), 0,0);
//Ok, at this point we can check the image dimensions and center it based on the bitmap size itself
pBG->GetVar("pos2d")->Set( (GetScreenSize()/2) - pBG->GetVar("size2d")->GetVector2()/2);
// pBG->AddComponent(new FocusInputComponent);
pBG->GetVar("finishMenuName")->Set(parentName);
if (bRequireMoveMessages)
{
pBG->GetVar("requireMoveMessages")->Set(uint32(1));
}
AddFocusIfNeeded(pBG);
CL_Vec2f vTextArea = pBG->GetVar("size2d")->GetVector2();
float padding = 30;
vTextArea.x -= iPhoneMapX2X(padding*2);
//add our msg and word wrap it
Entity *pText = CreateTextBoxEntity(pBG, "pop_up_text", (pBG->GetVar("size2d")->GetVector2()/2)+CL_Vec2f(0, iPhoneMapY2X(-17)), vTextArea, msg);
SetAlignmentEntity(pText, ALIGNMENT_CENTER);
float textHeight = pText->GetVar("size2d")->GetVector2().y;
FadeInEntity(pBG, true, 300);
//pText->GetVar("color")->Set(MAKE_RGBA(203,177,137,255));
pBG->GetVar("gamePaused")->Set(uint32(bGamePaused != 0)); //remember this for later
Entity *pButton = NULL;
CL_Vec2f vButtonSize;
Entity *pLabel;
Entity *pButton1, *pButton2;
float buttonHeight = iPhoneMapY2X(120);
if (textHeight > iPhoneMapY2X(50))
{
//well, we need more space for this much text. Move the buttons down a bit.
buttonHeight = iPhoneMapY2X(135);
}
//add the buttons
pButton = CreateOverlayEntity(pBG, "button1", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(21), buttonHeight);
pButton1 = pButton;
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button1Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button1Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 250);
if (button2Label.empty())
{
//we only have one button? Fine, center it.
pButton->GetVar("pos2d")->Set(iPhoneMapX(88), buttonHeight);
} else
{
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapY2X(180), buttonHeight);
pButton2 = pButton;
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button2Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button2Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 350);
if (button3Label.empty())
{
//we only have two buttons? fine. Done then
} else
{
pButton1->GetVar("pos2d")->Set(iPhoneMapX2X(20), buttonHeight);
pButton2->GetVar("pos2d")->Set(iPhoneMapX2X(180), buttonHeight);
//move stuff around and add a third button
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(100), buttonHeight);
vButtonSize = pButton->GetVar("size2d")->GetVector2();
//add the text label
pLabel = CreateTextButtonEntity(pButton, button3Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button3Label, false);
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
pLabel->GetVar("url")->Set(url); //just in case we want to know this later, store it in the button itself
FadeInEntity(pButton, true, 300, 450);
}
}
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}

View file

@ -11,7 +11,7 @@ void QuickTipMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
GetAudioManager()->Play("audio/tip_end.wav");
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
FadeScreen(pDarken, 0, 0, 400, true);
KillEntity(pDarken, 400);
@ -114,7 +114,7 @@ Entity * CreateQuickTip(Entity *pParentEnt, string tipFileName, bool bRequireMov
//pButtonEntity = CreateOverlayButtonEntity(pBG, "continue", "interface/quicktips/tip_continue.rttex", 178, 184);
pButtonEntity->GetFunction("OnButtonSelected")->sig_function.connect(&QuickTipMenuOnSelect);
SlideScreen(pBG, true);
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//FadeInEntity(pBG, true, 300);
GetAudioManager()->Play("audio/tip_start.wav");

View file

@ -30,7 +30,7 @@ void ReadTextMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
return;
}
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
}

View file

@ -20,6 +20,8 @@ const float SAVE_FORMAT_VERSION = 1.9f;
const int C_DINK_FADE_TIME_MS = 300;
const float G_TRANSITION_SCALE_TRICK = 1.01f;
bool g_forceRebuildBackground = false;
float g_dinkFadeAlpha = 0;
DinkGlobals g_dglo;
@ -528,11 +530,15 @@ byte get_hard(int h,int x1, int y1)
}
if (x1 < 0 || y1 < 0 || x1 > 599 || y1 > 399) return(0);
value = g_dglos.g_hitmap.x[x1].y[y1];
//if (GetApp()->GetGhostMode() && value != 100) return 0; //cheat enabled
return(value);
}
byte get_hard_play(int h,int x1, int y1)
{
int value;
x1 -= 20;
@ -557,6 +563,9 @@ byte get_hard_play(int h,int x1, int y1)
value = 0;
}
}
//if (GetApp()->GetGhostMode() && value != 100) return 0; //cheat enabled
return(value);
}
@ -761,7 +770,12 @@ bool LoadTileScreenIfNeeded(int h, bool &bRequireRebuild)
if (h < 10) fName += "0";
fName += toString(h)+".bmp";
if (g_dglos.g_playerInfo.tile[h].file[0] != 0)
{
//LogMsg("We should load %s", g_dglos.g_playerInfo.tile[h].file);
fName = ToLowerCaseString(g_dglos.g_playerInfo.tile[h].file);
}
if (g_tileScreens[h])
{
@ -4823,7 +4837,7 @@ void check_midi(void)
bool StopMidi()
{
g_dglo.m_lastMusicPath = "";
LogMsg("Stopping midi");
//LogMsg("Stopping midi");
GetAudioManager()->StopMusic();
// Yahoo!
return true;
@ -6112,6 +6126,12 @@ void BuildScreenBackground( bool bFullRebuild )
int pa, cool;
*pvision = 0;
if (g_forceRebuildBackground)
{
bFullRebuild = true;
g_forceRebuildBackground = false;
}
if (bFullRebuild)
{
#ifdef _DEBUG
@ -9528,9 +9548,17 @@ LogMsg("%d scripts used", g_dglos.g_returnint);
h = &h[strlen(ev[1])];
int32 p[20] = {2,1,0,0,0,0,0,0,0,0};
if (get_parms(ev[1], script, h, p))
{
assert(!"Unsupported");
LogMsg("Command load_tile unsupported");
{
string fName = ToLowerCaseString(slist[0]);
int tileIndex = g_nlist[1];
//force a reload of this tile screen (Dink loads all graphics "on demand")
SAFE_DELETE(g_tileScreens[tileIndex]); //logically
//remember this change
strncpy(g_dglos.g_playerInfo.tile[tileIndex].file, fName.c_str(), 50); //this 50 is hardcoded in the player data
g_forceRebuildBackground = true;
//BuildScreenBackground(true); //trigger full rebuild, this could be optimized by setting a flag and only doing it once...
}
strcpy(pLineIn, h);
@ -12086,7 +12114,9 @@ int check_if_move_is_legal(int u)
if (u == 1) if (in_this_base(g_sprite[u].seq, g_dglos.mDinkBasePush)) return(0);
if (u == 1) if (!no_cheat) if (debug_mode) return(0);
int hardness = 0;
int hardness = 0;
if (g_sprite[u].moveman > 0)
{
for (int i=1; i <= g_sprite[u].moveman; i++)
@ -12098,30 +12128,41 @@ int check_if_move_is_legal(int u)
// redink1 changed so flying works properly
return(0);
}
if (u == 1)
{
//it's dink, should we cheat and walk through stuff?
if (GetApp()->GetGhostMode()) return 0;
}
if (hardness > 0)
{
g_sprite[u].x = g_sprite[u].lpx[i-1];
g_sprite[u].y = g_sprite[u].lpy[i-1];
g_sprite[u].moveman = 0;
{
if (g_dglos.g_pushingEnabled)
if (u == 1) if (hardness != 2) if (g_dglos.g_playerInfo.push_active == false)
{
if ( (g_sprite[u].dir == 2) | (g_sprite[u].dir == 4) | (g_sprite[u].dir == 6) | (g_sprite[u].dir == 8) )
{
//he (dink) is definatly pushing on something
g_dglos.g_playerInfo.push_active = true;
g_dglos.g_playerInfo.push_dir = g_sprite[u].dir;
g_dglos.g_playerInfo.push_timer = g_dglos.g_dinkTick;
g_sprite[u].x = g_sprite[u].lpx[i - 1];
g_sprite[u].y = g_sprite[u].lpy[i - 1];
g_sprite[u].moveman = 0;
}
} else
{
if (g_dglos.g_playerInfo.push_dir != g_sprite[1].dir) g_dglos.g_playerInfo.push_active = false;
}
return(hardness);
}
if (g_dglos.g_pushingEnabled)
if (u == 1) if (hardness != 2) if (g_dglos.g_playerInfo.push_active == false)
{
if ((g_sprite[u].dir == 2) | (g_sprite[u].dir == 4) | (g_sprite[u].dir == 6) | (g_sprite[u].dir == 8))
{
//he (dink) is definatly pushing on something
g_dglos.g_playerInfo.push_active = true;
g_dglos.g_playerInfo.push_dir = g_sprite[u].dir;
g_dglos.g_playerInfo.push_timer = g_dglos.g_dinkTick;
}
}
else
{
if (g_dglos.g_playerInfo.push_dir != g_sprite[1].dir) g_dglos.g_playerInfo.push_active = false;
}
return(hardness);
}
}
}
@ -12476,13 +12517,16 @@ void BlitSecondTransitionScreen()
void did_player_cross_screen(bool bCheckWithoutMoving, int playerID)
{
bool move_gonna = false;
bool move_gonna = false;
bool bNotScreenLocked = (g_dglos.screenlock == 0);
if (GetApp()->GetGhostMode()) bNotScreenLocked = true;
if (g_dglos.walk_off_screen == 1) return;
//DO MATH TO SEE IF THEY HAVE CROSSED THE SCREEN, IF SO LOAD NEW ONE
if ((g_sprite[playerID].x) < g_gameAreaLeftOffset)
{
if ((g_MapInfo.loc[*pmap-1] > 0) && (g_dglos.screenlock == 0) )
if ((g_MapInfo.loc[*pmap-1] > 0) && bNotScreenLocked)
{
//move one map to the left
if (bCheckWithoutMoving)
@ -12508,7 +12552,7 @@ bool move_gonna = false;
if ((g_sprite[playerID].x) > 619)
{
if ((g_MapInfo.loc[*pmap+1] > 0) && (g_dglos.screenlock == 0) )
if ((g_MapInfo.loc[*pmap+1] > 0) && bNotScreenLocked)
{
//move one map to the right
if (bCheckWithoutMoving)
@ -12535,7 +12579,7 @@ bool move_gonna = false;
if (g_sprite[playerID].y < 0)
{
if ((g_MapInfo.loc[*pmap-32] > 0) && (g_dglos.screenlock == 0) )
if ((g_MapInfo.loc[*pmap-32] > 0) && bNotScreenLocked)
{
//move one map up
if (bCheckWithoutMoving)
@ -12562,7 +12606,7 @@ bool move_gonna = false;
if ( (g_sprite[playerID].y > 399 ) )
{
if ( (g_MapInfo.loc[*pmap+32] > 0) && (g_dglos.screenlock == 0) )
if ( (g_MapInfo.loc[*pmap+32] > 0) && bNotScreenLocked)
{
//move one map down
if (bCheckWithoutMoving)
@ -15899,16 +15943,6 @@ LastWindowsTimer = GetTickCount();
if (g_dglos.screenlock == 1)
{
#ifdef _DEBUG
/*
if (debug_mode)
{
//CHEAT - ignore screenlocks
g_dglos.screenlock = 0;
}
*/
#endif
drawscreenlock();
}

View file

@ -386,7 +386,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\source;..\..\shared;..\..\shared\win\;..\..\shared\util\boost;..\..\shared\ClanLib-2.0\Sources;..\..\shared\win\include;..\..\shared\FliteTTS\include;..\..\shared\Irrlicht\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;C_GL_MODE;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;_NO_DEBUG_HEAP=1;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_RUNS_IN_BACKGROUND;RT_IPV6;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;C_GL_MODE;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;_NO_DEBUG_HEAP=1;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_RUNS_IN_BACKGROUND_DISABLED;RT_IPV6;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -431,7 +431,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release GL|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\source;..\..\shared;..\..\shared\win\;..\..\shared\util\boost;..\..\shared\ClanLib-2.0\Sources;..\..\shared\win\include;..\..\shared\FliteTTS\include;..\dxsdk\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;_USE_32BIT_TIME_T;C_GL_MODE;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_IPV6;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;_USE_32BIT_TIME_T;C_GL_MODE;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_IPV6;RT_RUNS_IN_BACKGROUNDD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PlatformPrecomp.h</PrecompiledHeaderFile>