* 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:
parent
e0717ae8d1
commit
ba5fb5abbf
18 changed files with 665 additions and 603 deletions
|
@ -80,3 +80,9 @@ www.rtsoft.com
|
||||||
* Added redink1's "soft shadow improvement" patch
|
* 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
|
* (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
|
||||||
|
|
|
@ -172,7 +172,7 @@ App::App()
|
||||||
{
|
{
|
||||||
http://www.rtsoft.com
|
http://www.rtsoft.com
|
||||||
|
|
||||||
|
m_bGhostMode = false;
|
||||||
#ifdef ANDROID_NDK
|
#ifdef ANDROID_NDK
|
||||||
SetPreferSDCardForStorage(true);
|
SetPreferSDCardForStorage(true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -180,8 +180,8 @@ App::App()
|
||||||
m_bDidPostInit = false;
|
m_bDidPostInit = false;
|
||||||
m_bHasDMODSupport = true;
|
m_bHasDMODSupport = true;
|
||||||
//for mobiles
|
//for mobiles
|
||||||
m_version = 1.71f;
|
m_version = 1.72f;
|
||||||
m_versionString = "V1.7.1";
|
m_versionString = "V1.7.2";
|
||||||
m_build = 1;
|
m_build = 1;
|
||||||
m_bCheatsEnabled = false;
|
m_bCheatsEnabled = false;
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@ public:
|
||||||
void RemoveAndroidKeyboardKeys();
|
void RemoveAndroidKeyboardKeys();
|
||||||
void AddIcadeProvider();
|
void AddIcadeProvider();
|
||||||
bool GetForceAspectRatio();
|
bool GetForceAspectRatio();
|
||||||
|
bool GetGhostMode() {return m_bGhostMode;}
|
||||||
|
void SetGhostMode(bool bNew) { m_bGhostMode = bNew; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -93,6 +95,7 @@ private:
|
||||||
int m_special;
|
int m_special;
|
||||||
bool m_bUsingTouchScreen;
|
bool m_bUsingTouchScreen;
|
||||||
bool m_bForceAspectRatio;
|
bool m_bForceAspectRatio;
|
||||||
|
bool m_bGhostMode; //lets dink walk anywhere and ignore screenlocks
|
||||||
|
|
||||||
void SaveAllData();
|
void SaveAllData();
|
||||||
void OnPreEnterBackground(VariantList *pVList);
|
void OnPreEnterBackground(VariantList *pVList);
|
||||||
|
|
|
@ -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)
|
void AddBlurb(Entity* pParent, float x, float y, string fileName, string msg)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
void DMODInstallUpdateStatus(Entity *pMenu, string msg)
|
||||||
|
|
|
@ -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()
|
CL_Vec2f GetDMODBarIconOffset()
|
||||||
|
|
|
@ -1,108 +1,124 @@
|
||||||
#include "PlatformPrecomp.h"
|
#include "PlatformPrecomp.h"
|
||||||
#include "DebugMenu.h"
|
#include "DebugMenu.h"
|
||||||
#include "Entity/EntityUtils.h"
|
#include "Entity/EntityUtils.h"
|
||||||
#include "dink/dink.h"
|
#include "dink/dink.h"
|
||||||
#include "LogMenu.h"
|
#include "LogMenu.h"
|
||||||
|
#include "GameMenu.h"
|
||||||
void DebugMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
|
|
||||||
{
|
void DebugMenuOnSelect(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();
|
||||||
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
|
||||||
|
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
||||||
if (pEntClicked->GetName() == "FPS")
|
|
||||||
{
|
if (pEntClicked->GetName() == "FPS")
|
||||||
GetBaseApp()->SetFPSVisible(!GetBaseApp()->GetFPSVisible());
|
{
|
||||||
}
|
GetBaseApp()->SetFPSVisible(!GetBaseApp()->GetFPSVisible());
|
||||||
|
}
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "music_on")
|
|
||||||
{
|
if (pEntClicked->GetName() == "music_on")
|
||||||
GetAudioManager()->Play("audio/intro.ogg", true, true);
|
{
|
||||||
}
|
GetAudioManager()->Play("audio/intro.ogg", true, true);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "music_off")
|
|
||||||
{
|
if (pEntClicked->GetName() == "music_off")
|
||||||
GetAudioManager()->StopMusic();
|
{
|
||||||
}
|
GetAudioManager()->StopMusic();
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "log")
|
|
||||||
{
|
if (pEntClicked->GetName() == "log")
|
||||||
RemoveFocusIfNeeded(pEntClicked->GetParent());
|
{
|
||||||
SlideScreen(pEntClicked->GetParent(), false);
|
RemoveFocusIfNeeded(pEntClicked->GetParent());
|
||||||
LogMenuCreate(pEntClicked->GetParent()->GetParent());
|
SlideScreen(pEntClicked->GetParent(), false);
|
||||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
LogMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||||
}
|
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "Back")
|
|
||||||
{
|
if (pEntClicked->GetName() == "Back")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
RemoveFocusIfNeeded(pEntClicked->GetParent());
|
//slide it off the screen and then kill the whole menu tree
|
||||||
SlideScreen(pEntClicked->GetParent(), false);
|
RemoveFocusIfNeeded(pEntClicked->GetParent());
|
||||||
AddFocusIfNeeded(pEntClicked->GetParent()->GetParent());
|
SlideScreen(pEntClicked->GetParent(), false);
|
||||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
AddFocusIfNeeded(pEntClicked->GetParent()->GetParent());
|
||||||
}
|
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "AddStrength")
|
|
||||||
{
|
if (pEntClicked->GetName() == "AddStrength")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkModStrength(1);
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkModStrength(1);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "AddDefense")
|
|
||||||
{
|
if (pEntClicked->GetName() == "AddDefense")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkModDefense(1);
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkModDefense(1);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "AddMagic")
|
|
||||||
{
|
if (pEntClicked->GetName() == "AddMagic")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkModMagic(1);
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkModMagic(1);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "AddLife")
|
|
||||||
{
|
if (pEntClicked->GetName() == "AddLife")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkModLifeMax(10);
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkModLifeMax(10);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "FillLife")
|
|
||||||
{
|
if (pEntClicked->GetName() == "FillLife")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkFillLife();
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkFillLife();
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "AddGold")
|
|
||||||
{
|
if (pEntClicked->GetName() == "AddGold")
|
||||||
//slide it off the screen and then kill the whole menu tree
|
{
|
||||||
DinkModGold(100);
|
//slide it off the screen and then kill the whole menu tree
|
||||||
}
|
DinkModGold(100);
|
||||||
|
}
|
||||||
if (pEntClicked->GetName() == "empty_cache")
|
|
||||||
{
|
if (pEntClicked->GetName() == "ghost_walk")
|
||||||
DinkUnloadGraphicsCache();
|
{
|
||||||
LogMsg("Cache emptied");
|
GetApp()->SetGhostMode(!GetApp()->GetGhostMode());
|
||||||
}
|
if (GetApp()->GetGhostMode())
|
||||||
if (pEntClicked->GetName() == "AddBow")
|
{
|
||||||
{
|
ShowQuickMessage("Ghost walk enabled - can walk through hardness and screenlocks");
|
||||||
//slide it off the screen and then kill the whole menu tree
|
}
|
||||||
DinkAddBow();
|
else
|
||||||
}
|
{
|
||||||
|
ShowQuickMessage("Ghost walk disabled");
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pEntClicked->GetName() == "empty_cache")
|
||||||
Entity * DebugMenuCreate(Entity *pParentEnt)
|
{
|
||||||
{
|
DinkUnloadGraphicsCache();
|
||||||
//Entity *pBG = CreateOverlayEntity(pParentEnt, "DebugMenu", "interface/generic_bg.rttex", 0,0);
|
LogMsg("Cache emptied");
|
||||||
|
}
|
||||||
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
|
|
||||||
|
if (pEntClicked->GetName() == "AddBow")
|
||||||
AddFocusIfNeeded(pBG);
|
{
|
||||||
|
//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;
|
Entity *pButtonEntity;
|
||||||
float x = iPhoneMapX(30);
|
float x = iPhoneMapX(30);
|
||||||
|
@ -110,54 +126,57 @@ Entity * DebugMenuCreate(Entity *pParentEnt)
|
||||||
float ySpacer = iPhoneMapY(40);
|
float ySpacer = iPhoneMapY(40);
|
||||||
|
|
||||||
pButtonEntity = CreateTextButtonEntity(pBG, "FPS", x, y, "Toggle FPS Display"); y += ySpacer;
|
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));
|
//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 = 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 = 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 = 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));
|
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
||||||
|
|
||||||
|
|
||||||
if (GetApp()->GetCheatsEnabled())
|
if (GetApp()->GetCheatsEnabled())
|
||||||
{
|
{
|
||||||
//buttons on right
|
//buttons on right
|
||||||
x = iPhoneMapX(200);
|
x = iPhoneMapX(200);
|
||||||
y = iPhoneMapY(30);
|
y = iPhoneMapY(30);
|
||||||
|
|
||||||
pButtonEntity = CreateTextButtonEntity(pBG, "AddStrength", x, y, "Increase Strength"); y += ySpacer;
|
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 = 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 = 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 = 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 = 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 = 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 = 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);
|
SlideScreen(pBG, true, 500);
|
||||||
|
|
||||||
|
|
||||||
return pBG;
|
return pBG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent fr
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameOnStopSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
#include "PlatformPrecomp.h"
|
#include "PlatformPrecomp.h"
|
||||||
#include "LoadMenu.h"
|
#include "LoadMenu.h"
|
||||||
#include "Entity/EntityUtils.h"
|
#include "Entity/EntityUtils.h"
|
||||||
#include "MainMenu.h"
|
#include "MainMenu.h"
|
||||||
#include "dink/dink.h"
|
#include "dink/dink.h"
|
||||||
#include "GameMenu.h"
|
#include "GameMenu.h"
|
||||||
|
|
||||||
#define C_SAVE_GAME_COUNT 10
|
#define C_SAVE_GAME_COUNT 10
|
||||||
|
|
||||||
void LoadMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
|
void LoadMenuOnSelect(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();
|
||||||
|
|
||||||
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "Back")
|
if (pEntClicked->GetName() == "Back")
|
||||||
{
|
{
|
||||||
//slide it off the screen and then kill the whole menu tree
|
//slide it off the screen and then kill the whole menu tree
|
||||||
SlideScreen(pEntClicked->GetParent(), false);
|
SlideScreen(pEntClicked->GetParent(), false);
|
||||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||||
MainMenuCreate(pEntClicked->GetParent()->GetParent());
|
MainMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||||
//LoadMenuCreate(GetParent()
|
//LoadMenuCreate(GetParent()
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = atol(pEntClicked->GetName().c_str());
|
int num = atol(pEntClicked->GetName().c_str());
|
||||||
|
|
||||||
if (num > 0)
|
if (num > 0)
|
||||||
{
|
{
|
||||||
//let's load this sucka
|
//let's load this sucka
|
||||||
DisableAllButtonsEntity(pEntClicked->GetParent());
|
DisableAllButtonsEntity(pEntClicked->GetParent());
|
||||||
SlideScreen(pEntClicked->GetParent(), false);
|
SlideScreen(pEntClicked->GetParent(), false);
|
||||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||||
|
|
||||||
if (num == 10)
|
if (num == 10)
|
||||||
{
|
{
|
||||||
string fName = GetSavePath()+"dink/"+"autosave.dat";
|
string fName = GetSavePath()+"dink/"+"autosave.dat";
|
||||||
GameCreate(pEntClicked->GetParent()->GetParent(), 0, fName);
|
GameCreate(pEntClicked->GetParent()->GetParent(), 0, fName);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
GameCreate(pEntClicked->GetParent()->GetParent(), num, "");
|
GameCreate(pEntClicked->GetParent()->GetParent(), num, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for Loading
|
//GetEntityRoot()->PrintTreeAsText(); //useful for Loading
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupLoadButton(Entity *pParent, int x, float *pY, int gameID)
|
void SetupLoadButton(Entity *pParent, int x, float *pY, int gameID)
|
||||||
{
|
{
|
||||||
gameID++; //it's 1 based, not 0 based
|
gameID++; //it's 1 based, not 0 based
|
||||||
|
|
||||||
const float ySpacer = 46;
|
const float ySpacer = 46;
|
||||||
if (gameID > 5) x += 200;
|
if (gameID > 5) x += 200;
|
||||||
|
|
||||||
char stTemp[256];
|
char stTemp[256];
|
||||||
char stFormatted[256];
|
char stFormatted[256];
|
||||||
string clickKey = ""; //none
|
string clickKey = ""; //none
|
||||||
int gameTime;
|
int gameTime;
|
||||||
|
|
||||||
if (gameID == 10)
|
if (gameID == 10)
|
||||||
{
|
{
|
||||||
string autoSave = DinkGetSavePath() + "autosave.dat";
|
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());
|
sprintf(stFormatted, "Auto Save - %d:%02d - %s", (gameTime / 60), gameTime - ((gameTime / 60) * 60), description.c_str());
|
||||||
clickKey = toString(gameID);
|
clickKey = toString(gameID);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (load_game_small(gameID, stTemp, &gameTime))
|
if (load_game_small(gameID, stTemp, &gameTime))
|
||||||
{
|
{
|
||||||
sprintf(stFormatted, "Slot %d - %d:%02d - %s", gameID, (gameTime / 60), gameTime - ((gameTime / 60) * 60) , stTemp);
|
sprintf(stFormatted, "Slot %d - %d:%02d - %s", gameID, (gameTime / 60), gameTime - ((gameTime / 60) * 60) , stTemp);
|
||||||
clickKey = toString(gameID);
|
clickKey = toString(gameID);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sprintf(stFormatted, "Slot %d - Empty", gameID);
|
sprintf(stFormatted, "Slot %d - Empty", gameID);
|
||||||
}
|
}
|
||||||
|
|
||||||
string butText = stFormatted;
|
string butText = stFormatted;
|
||||||
Entity * pButtonEntity = CreateTextButtonEntity(pParent, clickKey, iPhoneMapX(x), iPhoneMapY(*pY), butText, false); *pY += ySpacer;
|
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));
|
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity * LoadMenuCreate(Entity *pParentEnt)
|
Entity * LoadMenuCreate(Entity *pParentEnt)
|
||||||
{
|
{
|
||||||
Entity *pBG = CreateOverlayEntity(pParentEnt, "LoadMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
|
Entity *pBG = CreateOverlayEntity(pParentEnt, "LoadMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
|
||||||
AddFocusIfNeeded(pBG, true);
|
AddFocusIfNeeded(pBG, true);
|
||||||
|
|
||||||
Entity *pButtonEntity;
|
Entity *pButtonEntity;
|
||||||
float x = 80;
|
float x = 80;
|
||||||
|
@ -116,12 +116,12 @@ Entity * LoadMenuCreate(Entity *pParentEnt)
|
||||||
|
|
||||||
SetupLoadButton(pBG, x, &y, i);
|
SetupLoadButton(pBG, x, &y, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(x), iPhoneMapY(y), "Back"); y += ySpacer;
|
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));
|
//pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
|
|
||||||
SlideScreen(pBG, true, 500);
|
SlideScreen(pBG, true, 500);
|
||||||
return pBG;
|
return pBG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,98 +1,98 @@
|
||||||
#include "PlatformPrecomp.h"
|
#include "PlatformPrecomp.h"
|
||||||
#include "LogMenu.h"
|
#include "LogMenu.h"
|
||||||
#include "Entity/EntityUtils.h"
|
#include "Entity/EntityUtils.h"
|
||||||
#include "dink/dink.h"
|
#include "dink/dink.h"
|
||||||
#include "MainMenu.h"
|
#include "MainMenu.h"
|
||||||
|
|
||||||
void LogEnd(Entity *pMenu)
|
void LogEnd(Entity *pMenu)
|
||||||
{
|
{
|
||||||
//slide it off the screen and then kill the whole menu tree
|
//slide it off the screen and then kill the whole menu tree
|
||||||
RemoveFocusIfNeeded(pMenu);
|
RemoveFocusIfNeeded(pMenu);
|
||||||
//SlideScreen(pEntClicked->GetParent(), false);
|
//SlideScreen(pEntClicked->GetParent(), false);
|
||||||
AddFocusIfNeeded(pMenu->GetParent());
|
AddFocusIfNeeded(pMenu->GetParent());
|
||||||
FadeOutEntity(pMenu, true, 499);
|
FadeOutEntity(pMenu, true, 499);
|
||||||
GetMessageManager()->CallEntityFunction(pMenu, 500, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pMenu, 500, "OnDelete", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
|
void LogMenuOnSelect(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();
|
||||||
|
|
||||||
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
||||||
|
|
||||||
Entity *pMenu = GetEntityRoot()->GetEntityByName("LogMenu");
|
Entity *pMenu = GetEntityRoot()->GetEntityByName("LogMenu");
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "Back")
|
if (pEntClicked->GetName() == "Back")
|
||||||
{
|
{
|
||||||
LogEnd(pMenu);
|
LogEnd(pMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for Log
|
//GetEntityRoot()->PrintTreeAsText(); //useful for Log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LogAddScrollContent(Entity *pParent)
|
void LogAddScrollContent(Entity *pParent)
|
||||||
{
|
{
|
||||||
pParent = pParent->GetEntityByName("scroll_child");
|
pParent = pParent->GetEntityByName("scroll_child");
|
||||||
float x = iPhoneMapX(5);
|
float x = iPhoneMapX(5);
|
||||||
float y = 0;
|
float y = 0;
|
||||||
|
|
||||||
|
|
||||||
CL_Vec2f vTextBoxPos(iPhoneMapX(20),y);
|
CL_Vec2f vTextBoxPos(iPhoneMapX(20),y);
|
||||||
CL_Vec2f vTextBounds(iPhoneMapX(434), iPhoneMapY(200));
|
CL_Vec2f vTextBounds(iPhoneMapX(434), iPhoneMapY(200));
|
||||||
string msg = GetBaseApp()->GetConsole()->GetAsSingleString();
|
string msg = GetBaseApp()->GetConsole()->GetAsSingleString();
|
||||||
|
|
||||||
CreateTextBoxEntity(pParent, "", vTextBoxPos, vTextBounds, msg, 0.7f);
|
CreateTextBoxEntity(pParent, "", vTextBoxPos, vTextBounds, msg, 0.7f);
|
||||||
VariantList vList(pParent->GetParent());
|
VariantList vList(pParent->GetParent());
|
||||||
ResizeScrollBounds(&vList);
|
ResizeScrollBounds(&vList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity * LogMenuCreate(Entity *pParentEnt)
|
Entity * LogMenuCreate(Entity *pParentEnt)
|
||||||
{
|
{
|
||||||
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
|
Entity *pBG = CreateOverlayRectEntity(pParentEnt, CL_Vec2f(0,0), GetScreenSize(), MAKE_RGBA(0,0,0,140));
|
||||||
|
|
||||||
pBG->SetName("LogMenu");
|
pBG->SetName("LogMenu");
|
||||||
AddFocusIfNeeded(pBG, true);
|
AddFocusIfNeeded(pBG, true);
|
||||||
|
|
||||||
Entity *pButtonEntity;
|
Entity *pButtonEntity;
|
||||||
|
|
||||||
//setup a scrolling window
|
//setup a scrolling window
|
||||||
|
|
||||||
CL_Vec2f vTextAreaPos = CL_Vec2f(0,0);
|
CL_Vec2f vTextAreaPos = CL_Vec2f(0,0);
|
||||||
float offsetFromBottom = iPhoneMapY(30);
|
float offsetFromBottom = iPhoneMapY(30);
|
||||||
|
|
||||||
CL_Vec2f vTextAreaBounds = GetScreenSize()-CL_Vec2f(15,offsetFromBottom);
|
CL_Vec2f vTextAreaBounds = GetScreenSize()-CL_Vec2f(15,offsetFromBottom);
|
||||||
Entity *pScroll = pBG->AddEntity(new Entity("scroll"));
|
Entity *pScroll = pBG->AddEntity(new Entity("scroll"));
|
||||||
pScroll->GetVar("size2d")->Set(vTextAreaBounds);
|
pScroll->GetVar("size2d")->Set(vTextAreaBounds);
|
||||||
pScroll->AddComponent(new TouchHandlerComponent);
|
pScroll->AddComponent(new TouchHandlerComponent);
|
||||||
|
|
||||||
EntityComponent *pFilter = pScroll->AddComponent(new FilterInputComponent);
|
EntityComponent *pFilter = pScroll->AddComponent(new FilterInputComponent);
|
||||||
|
|
||||||
EntityComponent *pScrollComp = pScroll->AddComponent(new ScrollComponent);
|
EntityComponent *pScrollComp = pScroll->AddComponent(new ScrollComponent);
|
||||||
EntityComponent *pScrollBarComp = pScroll->AddComponent(new ScrollBarRenderComponent); //also let's add a visual way to see the scroller position
|
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));
|
pScroll->GetVar("color")->Set(MAKE_RGBA(61,155, 193, 255));
|
||||||
Entity *pScrollChild = pScroll->AddEntity(new Entity("scroll_child"));
|
Entity *pScrollChild = pScroll->AddEntity(new Entity("scroll_child"));
|
||||||
pScrollComp->GetVar("fingerTracking")->Set(uint32(1));
|
pScrollComp->GetVar("fingerTracking")->Set(uint32(1));
|
||||||
|
|
||||||
EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
|
EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
|
||||||
pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
|
pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
|
||||||
|
|
||||||
//Entity *pOverlay = CreateOverlayEntity(pBG, "", ReplaceWithDeviceNameInFileName("interface/iphone/bg_stone_overlay.rttex"), 0, GetScreenSizeYf());
|
//Entity *pOverlay = CreateOverlayEntity(pBG, "", ReplaceWithDeviceNameInFileName("interface/iphone/bg_stone_overlay.rttex"), 0, GetScreenSizeYf());
|
||||||
//SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
|
//SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
|
||||||
|
|
||||||
LogAddScrollContent(pBG);
|
LogAddScrollContent(pBG);
|
||||||
|
|
||||||
VariantList vList(CL_Vec2f(0.0f, 1.0f));
|
VariantList vList(CL_Vec2f(0.0f, 1.0f));
|
||||||
pScrollComp->GetFunction("SetProgress")->sig_function(&vList); //scroll to the end
|
pScrollComp->GetFunction("SetProgress")->sig_function(&vList); //scroll to the end
|
||||||
|
|
||||||
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(35), iPhoneMapY(300), "CONTINUE", false);
|
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(35), iPhoneMapY(300), "CONTINUE", false);
|
||||||
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LogMenuOnSelect);
|
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&LogMenuOnSelect);
|
||||||
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
||||||
|
|
||||||
FadeInEntity(pBG, true);
|
FadeInEntity(pBG, true);
|
||||||
return pBG;
|
return pBG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ void OptionsMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ void OptionsMenuAddScrollContent(Entity *pParent)
|
||||||
|
|
||||||
|
|
||||||
//fps limit
|
//fps limit
|
||||||
pEnt = CreateTextLabelEntity(pBG, "", startX, y, "FPS lock:");
|
pEnt = CreateTextLabelEntity(pBG, "", startX, y, "Lock to 30 FPS:");
|
||||||
SetupTextEntity(pEnt,fontID);
|
SetupTextEntity(pEnt,fontID);
|
||||||
offsetX = iPhoneMapX(columnX);
|
offsetX = iPhoneMapX(columnX);
|
||||||
pEnt = CreateTextButtonEntity(pBG, "fps_limit_0", offsetX, y, "On", false);
|
pEnt = CreateTextButtonEntity(pBG, "fps_limit_0", offsetX, y, "On", false);
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,251 +1,251 @@
|
||||||
#include "PlatformPrecomp.h"
|
#include "PlatformPrecomp.h"
|
||||||
#include "PopUpMenu.h"
|
#include "PopUpMenu.h"
|
||||||
#include "Entity/EntityUtils.h"
|
#include "Entity/EntityUtils.h"
|
||||||
#include "App.h"
|
#include "App.h"
|
||||||
|
|
||||||
Entity * PopUpRestoreFocusToOriginalMenu(Entity *pEntClicked)
|
Entity * PopUpRestoreFocusToOriginalMenu(Entity *pEntClicked)
|
||||||
{
|
{
|
||||||
Entity *pFinishMenu = GetEntityRoot()->GetEntityByName(pEntClicked->GetParent()->GetParent()->GetVar("finishMenuName")->GetString());
|
Entity *pFinishMenu = GetEntityRoot()->GetEntityByName(pEntClicked->GetParent()->GetParent()->GetVar("finishMenuName")->GetString());
|
||||||
assert(pFinishMenu);
|
assert(pFinishMenu);
|
||||||
|
|
||||||
if (pFinishMenu)
|
if (pFinishMenu)
|
||||||
{
|
{
|
||||||
if (pEntClicked->GetParent()->GetParent()->GetVar("requireMoveMessages")->GetUINT32() == 1)
|
if (pEntClicked->GetParent()->GetParent()->GetVar("requireMoveMessages")->GetUINT32() == 1)
|
||||||
{
|
{
|
||||||
AddFocusIfNeeded(pFinishMenu, true, 0);
|
AddFocusIfNeeded(pFinishMenu, true, 0);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
pFinishMenu->AddComponent(new FocusInputComponent);
|
pFinishMenu->AddComponent(new FocusInputComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pFinishMenu;
|
return pFinishMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReloadMainMenu(VariantList *pVList);
|
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
|
//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
|
void PopUpMenuOnSelect(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();
|
||||||
|
|
||||||
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
|
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
|
||||||
|
|
||||||
FadeOutEntity(pEntClicked->GetParent()->GetParent(), true, 300);
|
FadeOutEntity(pEntClicked->GetParent()->GetParent(), true, 300);
|
||||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent()->GetParent(), 500, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent()->GetParent(), 500, "OnDelete", NULL);
|
||||||
DisableAllButtonsEntity(pEntClicked->GetParent()->GetParent());
|
DisableAllButtonsEntity(pEntClicked->GetParent()->GetParent());
|
||||||
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
|
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
|
||||||
|
|
||||||
FadeScreen(pDarken, 0, 0, 400, true);
|
FadeScreen(pDarken, 0, 0, 400, true);
|
||||||
KillEntity(pDarken, 400);
|
KillEntity(pDarken, 400);
|
||||||
pDarken->SetName("");
|
pDarken->SetName("");
|
||||||
|
|
||||||
//set the game pause state back to whatever it was originally
|
//set the game pause state back to whatever it was originally
|
||||||
GetApp()->SetGameTickPause(pEntClicked->GetParent()->GetParent()->GetVar("gamePaused")->GetUINT32() != 0);
|
GetApp()->SetGameTickPause(pEntClicked->GetParent()->GetParent()->GetVar("gamePaused")->GetUINT32() != 0);
|
||||||
|
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "url")
|
if (pEntClicked->GetName() == "url")
|
||||||
{
|
{
|
||||||
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
|
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
|
||||||
LaunchURL(pEntClicked->GetVar("url")->GetString());
|
LaunchURL(pEntClicked->GetVar("url")->GetString());
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
} else if (pEntClicked->GetName() == "url_update")
|
} else if (pEntClicked->GetName() == "url_update")
|
||||||
{
|
{
|
||||||
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
|
LogMsg("Launch url: %s", pEntClicked->GetVar("url")->GetString().c_str());
|
||||||
LaunchURL(pEntClicked->GetVar("url")->GetString());
|
LaunchURL(pEntClicked->GetVar("url")->GetString());
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
//kill current menu
|
//kill current menu
|
||||||
//GetMessageManager()->CallEntityFunction(pFinishMenu, 200, "OnDelete", NULL);
|
//GetMessageManager()->CallEntityFunction(pFinishMenu, 200, "OnDelete", NULL);
|
||||||
|
|
||||||
PopUpCreate(pFinishMenu, "Please close the game and install the new version!", "", "cancel", "", "", "", true);
|
PopUpCreate(pFinishMenu, "Please close the game and install the new version!", "", "cancel", "", "", "", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (pEntClicked->GetName() == "music_disable")
|
if (pEntClicked->GetName() == "music_disable")
|
||||||
{
|
{
|
||||||
//add control back
|
//add control back
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
|
|
||||||
GetApp()->GetShared()->GetVar("musicDisabled")->Set(uint32(1));
|
GetApp()->GetShared()->GetVar("musicDisabled")->Set(uint32(1));
|
||||||
GetAudioManager()->SetMusicEnabled(false);
|
GetAudioManager()->SetMusicEnabled(false);
|
||||||
|
|
||||||
string msg = "Music disabled. You can re-enable it from the `wOptions`` menu later.";
|
string msg = "Music disabled. You can re-enable it from the `wOptions`` menu later.";
|
||||||
PopUpCreate(pFinishMenu, msg, "", "cancel", "Continue", "", "", true);
|
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
|
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
|
//we enable music again so we still want it
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "music_on")
|
if (pEntClicked->GetName() == "music_on")
|
||||||
{
|
{
|
||||||
//add control back
|
//add control back
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true);
|
GetAudioManager()->Play(GetApp()->GetMainMenuMusic(), true, true);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "quit_game")
|
if (pEntClicked->GetName() == "quit_game")
|
||||||
{
|
{
|
||||||
|
|
||||||
Entity *pGameMenu = GetEntityRoot()->GetEntityByName("GameMenu");
|
Entity *pGameMenu = GetEntityRoot()->GetEntityByName("GameMenu");
|
||||||
|
|
||||||
//GetApp()->SetGameType(GAME_TYPE_NONE);
|
//GetApp()->SetGameType(GAME_TYPE_NONE);
|
||||||
//slide it off the screen and then kill the whole menu tree
|
//slide it off the screen and then kill the whole menu tree
|
||||||
SlideScreen(pGameMenu, false, 500, 10);
|
SlideScreen(pGameMenu, false, 500, 10);
|
||||||
GetMessageManager()->CallEntityFunction(pGameMenu, 900, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pGameMenu, 900, "OnDelete", NULL);
|
||||||
//SummaryMenuCreate(pGameMenu->GetParent());
|
//SummaryMenuCreate(pGameMenu->GetParent());
|
||||||
GetBaseApp()->SetGameTickPause(false);
|
GetBaseApp()->SetGameTickPause(false);
|
||||||
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "cancel")
|
if (pEntClicked->GetName() == "cancel")
|
||||||
{
|
{
|
||||||
//add control back
|
//add control back
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
}if (pEntClicked->GetName() == "cancel_update")
|
}if (pEntClicked->GetName() == "cancel_update")
|
||||||
{
|
{
|
||||||
//add control back
|
//add control back
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
//kill current menu
|
//kill current menu
|
||||||
GetMessageManager()->CallEntityFunction(pFinishMenu, 100, "OnDelete", NULL);
|
GetMessageManager()->CallEntityFunction(pFinishMenu, 100, "OnDelete", NULL);
|
||||||
|
|
||||||
VariantList vList(pFinishMenu->GetParent());
|
VariantList vList(pFinishMenu->GetParent());
|
||||||
GetMessageManager()->CallStaticFunction(ReloadMainMenu, 200, &vList, TIMER_SYSTEM);
|
GetMessageManager()->CallStaticFunction(ReloadMainMenu, 200, &vList, TIMER_SYSTEM);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
if (pEntClicked->GetName() == "reset")
|
if (pEntClicked->GetName() == "reset")
|
||||||
{
|
{
|
||||||
//add control back
|
//add control back
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
GetAudioManager()->Play("audio/tip_start.wav");
|
GetAudioManager()->Play("audio/tip_start.wav");
|
||||||
//GetHighScoreManager()->ResetLocalScores();
|
//GetHighScoreManager()->ResetLocalScores();
|
||||||
//belay that order, show another pop up...
|
//belay that order, show another pop up...
|
||||||
PopUpCreate(pFinishMenu, "Local high scores have been reset.", "", "cancel", "Continue", "", "", true);
|
PopUpCreate(pFinishMenu, "Local high scores have been reset.", "", "cancel", "Continue", "", "", true);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
//unhandled
|
//unhandled
|
||||||
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
Entity *pFinishMenu = PopUpRestoreFocusToOriginalMenu(pEntClicked);
|
||||||
|
|
||||||
//call this function on the original guy, just in case they want to do something with it
|
//call this function on the original guy, just in case they want to do something with it
|
||||||
VariantList vList(pFinishMenu, pEntClicked->GetName());
|
VariantList vList(pFinishMenu, pEntClicked->GetName());
|
||||||
pFinishMenu->GetFunction(pEntClicked->GetName())->sig_function(&vList);
|
pFinishMenu->GetFunction(pEntClicked->GetName())->sig_function(&vList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopUpCreate(Entity *pEnt, string msg, string url, string button1Action, string button1Label, string button2Action, string button2Label,
|
void PopUpCreate(Entity *pEnt, string msg, string url, string button1Action, string button1Label, string button2Action, string button2Label,
|
||||||
bool bRequireMoveMessages, string button3Action, string button3Label)
|
bool bRequireMoveMessages, string button3Action, string button3Label)
|
||||||
{
|
{
|
||||||
pEnt->RemoveComponentByName("FocusInput");
|
pEnt->RemoveComponentByName("FocusInput");
|
||||||
|
|
||||||
bool bGamePaused = GetBaseApp()->GetGameTickPause();
|
bool bGamePaused = GetBaseApp()->GetGameTickPause();
|
||||||
GetBaseApp()->SetGameTickPause(true);
|
GetBaseApp()->SetGameTickPause(true);
|
||||||
// GetMessageManager()->RemoveComponentByName(pEnt, 201, "FocusInput"); //hack that works around a problem of pending FocusInput messages coming in
|
// 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
|
//remember where we should give focus to later
|
||||||
string parentName = pEnt->GetName();
|
string parentName = pEnt->GetName();
|
||||||
assert(!parentName.empty());
|
assert(!parentName.empty());
|
||||||
|
|
||||||
//let's build our own menu right on the GUI branch of the tree
|
//let's build our own menu right on the GUI branch of the tree
|
||||||
pEnt = GetEntityRoot()->GetEntityByName("GUI");
|
pEnt = GetEntityRoot()->GetEntityByName("GUI");
|
||||||
Entity *pDarken = pEnt->AddEntity(new Entity("pop_up_darken"));
|
Entity *pDarken = pEnt->AddEntity(new Entity("pop_up_darken"));
|
||||||
pDarken->AddComponent(new FocusRenderComponent);
|
pDarken->AddComponent(new FocusRenderComponent);
|
||||||
pDarken->AddComponent(new FocusUpdateComponent);
|
pDarken->AddComponent(new FocusUpdateComponent);
|
||||||
FadeScreen(pDarken, 0, 0.7, 400, false); //fade the whole GUI
|
FadeScreen(pDarken, 0, 0.7, 400, false); //fade the whole GUI
|
||||||
|
|
||||||
//add our prompt
|
//add our prompt
|
||||||
Entity *pBG = CreateOverlayEntity(pEnt, "pop_up", ReplaceWithLargeInFileName("interface/iphone/pop_up.rttex"), 0,0);
|
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
|
//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->GetVar("pos2d")->Set( (GetScreenSize()/2) - pBG->GetVar("size2d")->GetVector2()/2);
|
||||||
|
|
||||||
// pBG->AddComponent(new FocusInputComponent);
|
// pBG->AddComponent(new FocusInputComponent);
|
||||||
pBG->GetVar("finishMenuName")->Set(parentName);
|
pBG->GetVar("finishMenuName")->Set(parentName);
|
||||||
|
|
||||||
if (bRequireMoveMessages)
|
if (bRequireMoveMessages)
|
||||||
{
|
{
|
||||||
pBG->GetVar("requireMoveMessages")->Set(uint32(1));
|
pBG->GetVar("requireMoveMessages")->Set(uint32(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddFocusIfNeeded(pBG);
|
AddFocusIfNeeded(pBG);
|
||||||
CL_Vec2f vTextArea = pBG->GetVar("size2d")->GetVector2();
|
CL_Vec2f vTextArea = pBG->GetVar("size2d")->GetVector2();
|
||||||
float padding = 30;
|
float padding = 30;
|
||||||
vTextArea.x -= iPhoneMapX2X(padding*2);
|
vTextArea.x -= iPhoneMapX2X(padding*2);
|
||||||
|
|
||||||
//add our msg and word wrap it
|
//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);
|
Entity *pText = CreateTextBoxEntity(pBG, "pop_up_text", (pBG->GetVar("size2d")->GetVector2()/2)+CL_Vec2f(0, iPhoneMapY2X(-17)), vTextArea, msg);
|
||||||
SetAlignmentEntity(pText, ALIGNMENT_CENTER);
|
SetAlignmentEntity(pText, ALIGNMENT_CENTER);
|
||||||
float textHeight = pText->GetVar("size2d")->GetVector2().y;
|
float textHeight = pText->GetVar("size2d")->GetVector2().y;
|
||||||
|
|
||||||
FadeInEntity(pBG, true, 300);
|
FadeInEntity(pBG, true, 300);
|
||||||
|
|
||||||
//pText->GetVar("color")->Set(MAKE_RGBA(203,177,137,255));
|
//pText->GetVar("color")->Set(MAKE_RGBA(203,177,137,255));
|
||||||
|
|
||||||
pBG->GetVar("gamePaused")->Set(uint32(bGamePaused != 0)); //remember this for later
|
pBG->GetVar("gamePaused")->Set(uint32(bGamePaused != 0)); //remember this for later
|
||||||
Entity *pButton = NULL;
|
Entity *pButton = NULL;
|
||||||
CL_Vec2f vButtonSize;
|
CL_Vec2f vButtonSize;
|
||||||
Entity *pLabel;
|
Entity *pLabel;
|
||||||
Entity *pButton1, *pButton2;
|
Entity *pButton1, *pButton2;
|
||||||
|
|
||||||
float buttonHeight = iPhoneMapY2X(120);
|
float buttonHeight = iPhoneMapY2X(120);
|
||||||
if (textHeight > iPhoneMapY2X(50))
|
if (textHeight > iPhoneMapY2X(50))
|
||||||
{
|
{
|
||||||
//well, we need more space for this much text. Move the buttons down a bit.
|
//well, we need more space for this much text. Move the buttons down a bit.
|
||||||
buttonHeight = iPhoneMapY2X(135);
|
buttonHeight = iPhoneMapY2X(135);
|
||||||
}
|
}
|
||||||
//add the buttons
|
//add the buttons
|
||||||
pButton = CreateOverlayEntity(pBG, "button1", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(21), buttonHeight);
|
pButton = CreateOverlayEntity(pBG, "button1", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(21), buttonHeight);
|
||||||
pButton1 = pButton;
|
pButton1 = pButton;
|
||||||
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
||||||
//add the text label
|
//add the text label
|
||||||
pLabel = CreateTextButtonEntity(pButton, button1Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button1Label, false);
|
pLabel = CreateTextButtonEntity(pButton, button1Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button1Label, false);
|
||||||
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
|
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
|
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);
|
FadeInEntity(pButton, true, 300, 250);
|
||||||
if (button2Label.empty())
|
if (button2Label.empty())
|
||||||
{
|
{
|
||||||
//we only have one button? Fine, center it.
|
//we only have one button? Fine, center it.
|
||||||
pButton->GetVar("pos2d")->Set(iPhoneMapX(88), buttonHeight);
|
pButton->GetVar("pos2d")->Set(iPhoneMapX(88), buttonHeight);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapY2X(180), buttonHeight);
|
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapY2X(180), buttonHeight);
|
||||||
pButton2 = pButton;
|
pButton2 = pButton;
|
||||||
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
||||||
//add the text label
|
//add the text label
|
||||||
pLabel = CreateTextButtonEntity(pButton, button2Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button2Label, false);
|
pLabel = CreateTextButtonEntity(pButton, button2Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button2Label, false);
|
||||||
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
|
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
|
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);
|
FadeInEntity(pButton, true, 300, 350);
|
||||||
|
|
||||||
if (button3Label.empty())
|
if (button3Label.empty())
|
||||||
{
|
{
|
||||||
//we only have two buttons? fine. Done then
|
//we only have two buttons? fine. Done then
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
pButton1->GetVar("pos2d")->Set(iPhoneMapX2X(20), buttonHeight);
|
pButton1->GetVar("pos2d")->Set(iPhoneMapX2X(20), buttonHeight);
|
||||||
pButton2->GetVar("pos2d")->Set(iPhoneMapX2X(180), buttonHeight);
|
pButton2->GetVar("pos2d")->Set(iPhoneMapX2X(180), buttonHeight);
|
||||||
|
|
||||||
//move stuff around and add a third button
|
//move stuff around and add a third button
|
||||||
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(100), buttonHeight);
|
pButton = CreateOverlayEntity(pBG, "button2", ReplaceWithLargeInFileName("interface/iphone/pop_up_button.rttex"), iPhoneMapX2X(100), buttonHeight);
|
||||||
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
vButtonSize = pButton->GetVar("size2d")->GetVector2();
|
||||||
//add the text label
|
//add the text label
|
||||||
pLabel = CreateTextButtonEntity(pButton, button3Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button3Label, false);
|
pLabel = CreateTextButtonEntity(pButton, button3Action, vButtonSize.x/2, vButtonSize.y/2, "`w"+button3Label, false);
|
||||||
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
pLabel->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
|
||||||
pLabel->GetFunction("OnButtonSelected")->sig_function.connect(&PopUpMenuOnSelect);
|
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
|
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);
|
FadeInEntity(pButton, true, 300, 450);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ void QuickTipMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
|
||||||
|
|
||||||
GetAudioManager()->Play("audio/tip_end.wav");
|
GetAudioManager()->Play("audio/tip_end.wav");
|
||||||
LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[1].Print().c_str());
|
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");
|
Entity *pDarken = GetEntityRoot()->GetEntityByName("pop_up_darken");
|
||||||
FadeScreen(pDarken, 0, 0, 400, true);
|
FadeScreen(pDarken, 0, 0, 400, true);
|
||||||
KillEntity(pDarken, 400);
|
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 = CreateOverlayButtonEntity(pBG, "continue", "interface/quicktips/tip_continue.rttex", 178, 184);
|
||||||
pButtonEntity->GetFunction("OnButtonSelected")->sig_function.connect(&QuickTipMenuOnSelect);
|
pButtonEntity->GetFunction("OnButtonSelected")->sig_function.connect(&QuickTipMenuOnSelect);
|
||||||
SlideScreen(pBG, true);
|
SlideScreen(pBG, true);
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
//FadeInEntity(pBG, true, 300);
|
//FadeInEntity(pBG, true, 300);
|
||||||
GetAudioManager()->Play("audio/tip_start.wav");
|
GetAudioManager()->Play("audio/tip_start.wav");
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void ReadTextMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
//GetEntityRoot()->PrintTreeAsText(); //useful for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ const float SAVE_FORMAT_VERSION = 1.9f;
|
||||||
const int C_DINK_FADE_TIME_MS = 300;
|
const int C_DINK_FADE_TIME_MS = 300;
|
||||||
|
|
||||||
const float G_TRANSITION_SCALE_TRICK = 1.01f;
|
const float G_TRANSITION_SCALE_TRICK = 1.01f;
|
||||||
|
bool g_forceRebuildBackground = false;
|
||||||
|
|
||||||
|
|
||||||
float g_dinkFadeAlpha = 0;
|
float g_dinkFadeAlpha = 0;
|
||||||
DinkGlobals g_dglo;
|
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);
|
if (x1 < 0 || y1 < 0 || x1 > 599 || y1 > 399) return(0);
|
||||||
value = g_dglos.g_hitmap.x[x1].y[y1];
|
value = g_dglos.g_hitmap.x[x1].y[y1];
|
||||||
|
|
||||||
|
//if (GetApp()->GetGhostMode() && value != 100) return 0; //cheat enabled
|
||||||
|
|
||||||
return(value);
|
return(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte get_hard_play(int h,int x1, int y1)
|
byte get_hard_play(int h,int x1, int y1)
|
||||||
{
|
{
|
||||||
|
|
||||||
int value;
|
int value;
|
||||||
x1 -= 20;
|
x1 -= 20;
|
||||||
|
|
||||||
|
@ -557,6 +563,9 @@ byte get_hard_play(int h,int x1, int y1)
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (GetApp()->GetGhostMode() && value != 100) return 0; //cheat enabled
|
||||||
|
|
||||||
return(value);
|
return(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,7 +770,12 @@ bool LoadTileScreenIfNeeded(int h, bool &bRequireRebuild)
|
||||||
if (h < 10) fName += "0";
|
if (h < 10) fName += "0";
|
||||||
fName += toString(h)+".bmp";
|
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])
|
if (g_tileScreens[h])
|
||||||
{
|
{
|
||||||
|
@ -4823,7 +4837,7 @@ void check_midi(void)
|
||||||
bool StopMidi()
|
bool StopMidi()
|
||||||
{
|
{
|
||||||
g_dglo.m_lastMusicPath = "";
|
g_dglo.m_lastMusicPath = "";
|
||||||
LogMsg("Stopping midi");
|
//LogMsg("Stopping midi");
|
||||||
GetAudioManager()->StopMusic();
|
GetAudioManager()->StopMusic();
|
||||||
// Yahoo!
|
// Yahoo!
|
||||||
return true;
|
return true;
|
||||||
|
@ -6112,6 +6126,12 @@ void BuildScreenBackground( bool bFullRebuild )
|
||||||
int pa, cool;
|
int pa, cool;
|
||||||
*pvision = 0;
|
*pvision = 0;
|
||||||
|
|
||||||
|
if (g_forceRebuildBackground)
|
||||||
|
{
|
||||||
|
bFullRebuild = true;
|
||||||
|
g_forceRebuildBackground = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (bFullRebuild)
|
if (bFullRebuild)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -9528,9 +9548,17 @@ LogMsg("%d scripts used", g_dglos.g_returnint);
|
||||||
h = &h[strlen(ev[1])];
|
h = &h[strlen(ev[1])];
|
||||||
int32 p[20] = {2,1,0,0,0,0,0,0,0,0};
|
int32 p[20] = {2,1,0,0,0,0,0,0,0,0};
|
||||||
if (get_parms(ev[1], script, h, p))
|
if (get_parms(ev[1], script, h, p))
|
||||||
{
|
{
|
||||||
assert(!"Unsupported");
|
string fName = ToLowerCaseString(slist[0]);
|
||||||
LogMsg("Command load_tile unsupported");
|
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);
|
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 (in_this_base(g_sprite[u].seq, g_dglos.mDinkBasePush)) return(0);
|
||||||
|
|
||||||
if (u == 1) if (!no_cheat) if (debug_mode) 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)
|
if (g_sprite[u].moveman > 0)
|
||||||
{
|
{
|
||||||
for (int i=1; i <= g_sprite[u].moveman; i++)
|
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
|
// redink1 changed so flying works properly
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (u == 1)
|
||||||
|
{
|
||||||
|
//it's dink, should we cheat and walk through stuff?
|
||||||
|
if (GetApp()->GetGhostMode()) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hardness > 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)
|
g_sprite[u].x = g_sprite[u].lpx[i - 1];
|
||||||
{
|
g_sprite[u].y = g_sprite[u].lpy[i - 1];
|
||||||
if ( (g_sprite[u].dir == 2) | (g_sprite[u].dir == 4) | (g_sprite[u].dir == 6) | (g_sprite[u].dir == 8) )
|
g_sprite[u].moveman = 0;
|
||||||
{
|
|
||||||
//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;
|
|
||||||
|
|
||||||
}
|
if (g_dglos.g_pushingEnabled)
|
||||||
} else
|
if (u == 1) if (hardness != 2) if (g_dglos.g_playerInfo.push_active == false)
|
||||||
{
|
{
|
||||||
if (g_dglos.g_playerInfo.push_dir != g_sprite[1].dir) 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))
|
||||||
}
|
{
|
||||||
return(hardness);
|
//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)
|
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;
|
if (g_dglos.walk_off_screen == 1) return;
|
||||||
//DO MATH TO SEE IF THEY HAVE CROSSED THE SCREEN, IF SO LOAD NEW ONE
|
//DO MATH TO SEE IF THEY HAVE CROSSED THE SCREEN, IF SO LOAD NEW ONE
|
||||||
if ((g_sprite[playerID].x) < g_gameAreaLeftOffset)
|
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
|
//move one map to the left
|
||||||
if (bCheckWithoutMoving)
|
if (bCheckWithoutMoving)
|
||||||
|
@ -12508,7 +12552,7 @@ bool move_gonna = false;
|
||||||
|
|
||||||
if ((g_sprite[playerID].x) > 619)
|
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
|
//move one map to the right
|
||||||
if (bCheckWithoutMoving)
|
if (bCheckWithoutMoving)
|
||||||
|
@ -12535,7 +12579,7 @@ bool move_gonna = false;
|
||||||
|
|
||||||
if (g_sprite[playerID].y < 0)
|
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
|
//move one map up
|
||||||
if (bCheckWithoutMoving)
|
if (bCheckWithoutMoving)
|
||||||
|
@ -12562,7 +12606,7 @@ bool move_gonna = false;
|
||||||
|
|
||||||
if ( (g_sprite[playerID].y > 399 ) )
|
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
|
//move one map down
|
||||||
if (bCheckWithoutMoving)
|
if (bCheckWithoutMoving)
|
||||||
|
@ -15899,16 +15943,6 @@ LastWindowsTimer = GetTickCount();
|
||||||
|
|
||||||
if (g_dglos.screenlock == 1)
|
if (g_dglos.screenlock == 1)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (debug_mode)
|
|
||||||
{
|
|
||||||
//CHEAT - ignore screenlocks
|
|
||||||
g_dglos.screenlock = 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
drawscreenlock();
|
drawscreenlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<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>
|
<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>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
@ -431,7 +431,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release GL|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release GL|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\source;..\..\shared;..\..\shared\win\;..\..\shared\util\boost;..\..\shared\ClanLib-2.0\Sources;..\..\shared\win\include;..\..\shared\FliteTTS\include;..\dxsdk\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<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>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>PlatformPrecomp.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>PlatformPrecomp.h</PrecompiledHeaderFile>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue