* (Windows) Mouse-controlled screens in DMODs control better and hide the original mouse cursor

* (Windows) Now remembers screen size and fullscreen mode (don't forget, you can drag the window corners around to customize the screen size as well)
* (Windows) Input URL input area gets focus by default when installing a DMOD by URL
* (bugfix) Can no longer tap F8 during a game load to load a save state too early which can freeze the game
* (bugfix) Fixed issue where 32 bit tilebitmaps would go wonky when reloading the surface
* Default color under status bar is now black, fixes issue when transparent colors are used in the stats area, random garbage would show through

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1473 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-09-13 01:24:32 +00:00
parent f7cc1910ce
commit e3ad75909f
9 changed files with 500 additions and 279 deletions

View file

@ -25,7 +25,7 @@
#ifdef WINAPI
#include "StackWalker/StackUtils.h"
extern bool g_bIsFullScreen;
#endif
@ -228,7 +228,7 @@ bool App::Init()
int scaleToX = 480;
int scaleToY = 320;
if (IsTabletSize())
if (IsTabletSize() || IsDesktop)
{
scaleToX = 1024;
scaleToY = 768;
@ -500,8 +500,27 @@ if (GetEmulatedPlatformID() == PLATFORM_ID_IOS)
//when screen size changes we'll unload surfaces
GetBaseApp()->m_sig_unloadSurfaces.connect(1, boost::bind(&App::OnUnloadSurfaces, this));
#ifdef WINAPI
int videox = GetApp()->GetVarWithDefault("video_x", uint32(0))->GetUINT32();
int videoy = GetApp()->GetVarWithDefault("video_y", uint32(0))->GetUINT32();
int fullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(0))->GetUINT32();
if (fullscreen)
{
LogMsg("Setting fullscreen...");
//GetMessageManager()->SendGUI(MESSAGE_TYPE_GUI_TOGGLE_FULLSCREEN, 0, 0); //lParam holds a lot of random data about the press, look it up if
OnFullscreenToggleRequest();
}
else
{
if (videox != 0 && videoy != 0)
{
//remember old setup
SetVideoMode(videox, videoy, false, 0);
}
}
#endif
return true;
}
@ -685,6 +704,13 @@ void App::OnScreenSizeChange()
}
}
#ifdef WINAPI
GetApp()->GetVar("fullscreen")->Set(uint32(g_bIsFullScreen));
GetApp()->GetVar("videox")->Set(uint32(GetPrimaryGLX()));
GetApp()->GetVar("videoy")->Set(uint32(GetPrimaryGLY()));
#endif
}
void App::GetServerInfo( string &server, uint32 &port )
@ -834,6 +860,18 @@ bool App::OnPreInitVideo()
// g_winVideoScreenX = 800;
// g_winVideoScreenY = 1280;
//windows only
VariantDB temp;
temp.Load("save.dat");
Variant *pVarX = temp.GetVarIfExists("videox");
Variant *pVarY = temp.GetVarIfExists("videoy");
if (pVarX && pVarY && pVarX->GetUINT32() != 0 && pVarY->GetUINT32() != 0)
{
g_winVideoScreenX = pVarX->GetUINT32();
g_winVideoScreenY = pVarY->GetUINT32();
}
#endif
return true;

View file

@ -1,165 +1,165 @@
#include "PlatformPrecomp.h"
#include "ActionButtonComponent.h"
#include "util/GLESUtils.h"
#include "Entity/EntityUtils.h"
#include "BaseApp.h"
#include "../dink/dink.h"
ActionButtonComponent::ActionButtonComponent()
{
SetName("ActionButton");
m_mode = MODE_MAGIC;
}
ActionButtonComponent::~ActionButtonComponent()
{
}
void ActionButtonComponent::OnAdd(Entity *pEnt)
{
EntityComponent::OnAdd(pEnt);
m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
if (GetParent()->GetName() != "magic")
{
m_mode = MODE_WEAPON;
}
/*
m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
m_pScale = &GetParent()->GetShared()->GetVarWithDefault("scale", Variant(1.0f))->GetFloat();
#include "PlatformPrecomp.h"
#include "ActionButtonComponent.h"
#include "util/GLESUtils.h"
#include "Entity/EntityUtils.h"
#include "BaseApp.h"
#include "../dink/dink.h"
ActionButtonComponent::ActionButtonComponent()
{
SetName("ActionButton");
m_mode = MODE_MAGIC;
}
ActionButtonComponent::~ActionButtonComponent()
{
}
void ActionButtonComponent::OnAdd(Entity *pEnt)
{
EntityComponent::OnAdd(pEnt);
m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
if (GetParent()->GetName() != "magic")
{
m_mode = MODE_WEAPON;
}
/*
m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
m_pScale = &GetParent()->GetShared()->GetVarWithDefault("scale", Variant(1.0f))->GetFloat();
m_pRotation = &GetParent()->GetVar("rotation")->GetFloat(); //in degrees
m_pColor = &GetParent()->GetShared()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
m_pColorMod = &GetParent()->GetShared()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
m_pColor = &GetParent()->GetShared()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
m_pColorMod = &GetParent()->GetShared()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
*/
m_pAlpha = &GetParent()->GetShared()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
m_pAlpha = &GetParent()->GetShared()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
//register ourselves to render if the parent does
GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnRender, this, _1));
GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnUpdate, this, _1));
UpdateIcon();
}
void ActionButtonComponent::OnRemove()
{
EntityComponent::OnRemove();
}
void ActionButtonComponent::OnRender(VariantList *pVList)
{
CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
Surface *pSurf;
switch (m_mode)
{
case MODE_MAGIC:
pSurf = DinkGetMagicIconImage();
break;
case MODE_WEAPON:
pSurf = DinkGetWeaponIconImage();
break;
}
if (pSurf)
{
rtRectf srcRect = pSurf->GetRectf();
rtRectf dstRect = srcRect;
if (IsLargeScreen())
{
dstRect = rtRectf(0,0, 90,90);
} else
{
dstRect = rtRectf(0,0, 44,39);
}
dstRect.AdjustPosition(vFinalPos.x, vFinalPos.y);
if (IsLargeScreen())
{
dstRect.AdjustPosition(19, 25);
} else
{
dstRect.AdjustPosition(9, 12);
}
pSurf->BlitEx(dstRect, srcRect, MAKE_RGBA(255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha));
if (g_dglo.GetActiveView() == DinkGlobals::VIEW_ZOOMED)
{
int alpha = int(255.0f * *m_pAlpha);
if (alpha > 2)
{
if (m_mode ==MODE_MAGIC)
{
float percent = DinkGetMagicChargePercent();
if (percent > 0)
{
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
if (percent == 1)
{
DrawFilledRect(rBar, MAKE_RGBA(0, 180, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 255* *m_pAlpha));
} else
{
DrawFilledRect(rBar, MAKE_RGBA(0, 100, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 170* *m_pAlpha));
}
}
} else
{
float percent = DinkGetHealthPercent();
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
DrawFilledRect(rBar, MAKE_RGBA(180, 0, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(255, 0, 0, 255* *m_pAlpha));
}
}
}
}
}
void ActionButtonComponent::OnUpdate(VariantList *pVList)
{
}
void ActionButtonComponent::UpdateIcon()
{
}
//register ourselves to render if the parent does
GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnRender, this, _1));
GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnUpdate, this, _1));
UpdateIcon();
}
void ActionButtonComponent::OnRemove()
{
EntityComponent::OnRemove();
}
void ActionButtonComponent::OnRender(VariantList *pVList)
{
CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
Surface *pSurf;
switch (m_mode)
{
case MODE_MAGIC:
pSurf = DinkGetMagicIconImage();
break;
case MODE_WEAPON:
pSurf = DinkGetWeaponIconImage();
break;
}
if (pSurf)
{
rtRectf srcRect = pSurf->GetRectf();
rtRectf dstRect = srcRect;
if (IsLargeScreen())
{
dstRect = rtRectf(0,0, 90,90);
} else
{
dstRect = rtRectf(0,0, 44,39);
}
dstRect.AdjustPosition(vFinalPos.x, vFinalPos.y);
if (IsLargeScreen())
{
dstRect.AdjustPosition(19, 25);
} else
{
dstRect.AdjustPosition(9, 12);
}
pSurf->BlitEx(dstRect, srcRect, MAKE_RGBA(255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha));
if (g_dglo.GetActiveView() == DinkGlobals::VIEW_ZOOMED)
{
int alpha = int(255.0f * *m_pAlpha);
if (alpha > 2)
{
if (m_mode ==MODE_MAGIC)
{
float percent = DinkGetMagicChargePercent();
if (percent > 0)
{
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
if (percent == 1)
{
DrawFilledRect(rBar, MAKE_RGBA(0, 180, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 255* *m_pAlpha));
} else
{
DrawFilledRect(rBar, MAKE_RGBA(0, 100, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 170* *m_pAlpha));
}
}
} else
{
float percent = DinkGetHealthPercent();
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
DrawFilledRect(rBar, MAKE_RGBA(180, 0, 0, 255* *m_pAlpha));
DrawRect(rBar, MAKE_RGBA(255, 0, 0, 255* *m_pAlpha));
}
}
}
}
}
void ActionButtonComponent::OnUpdate(VariantList *pVList)
{
}
void ActionButtonComponent::UpdateIcon()
{
}
Entity * CreateActionButtonEntity(Entity *pParentEnt, string name, string fileName, float x, float y)
{

View file

@ -6,11 +6,17 @@
CursorComponent::CursorComponent()
{
#ifdef WINAPI
ShowCursor(false);
#endif
SetName("Cursor");
}
CursorComponent::~CursorComponent()
{
#ifdef WINAPI
ShowCursor(true);
#endif
}
void CursorComponent::OnAdd(Entity *pEnt)
@ -28,6 +34,7 @@ void CursorComponent::OnAdd(Entity *pEnt)
GetParent()->GetFunction("OnInput")->sig_function.connect(1, boost::bind(&CursorComponent::OnInput, this, _1));
GetParent()->GetParent()->GetFunction("OnKillingControls")->sig_function.connect(1, boost::bind(&CursorComponent::OnKillingControls, this, _1));
}
void CursorComponent::OnRemove()
@ -58,30 +65,73 @@ void CursorComponent::OnUpdate(VariantList *pVList)
void CursorComponent::OnInput( VariantList *pVList )
{
//0 = message type, 1 = parent coordinate offset
CL_Vec2f pt = pVList->Get(1).GetVector2();
//pt += GetAlignmentOffset(*m_pSize2d, eAlignment(*m_pAlignment));
switch (eMessageType( int(pVList->Get(0).GetFloat())))
if (IsDesktop())
{
case MESSAGE_TYPE_GUI_CLICK_START:
//HandleClickStart(pt);
OnUpdatePos(pt);
break;
case MESSAGE_TYPE_GUI_CLICK_END:
if (!m_bDisable)
//controls for a real mouse
switch (eMessageType(int(pVList->Get(0).GetFloat())))
{
case MESSAGE_TYPE_GUI_CLICK_START:
//HandleClickStart(pt);
OnUpdatePos(pt);
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
}
break;
case MESSAGE_TYPE_GUI_CLICK_END:
if (!m_bDisable)
{
//HandleClickEnd(pt);
break;
case MESSAGE_TYPE_GUI_CLICK_MOVE:
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
OnUpdatePos(pt);
break;
}
}
//HandleClickEnd(pt);
break;
case MESSAGE_TYPE_GUI_CLICK_MOVE:
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
OnUpdatePos(pt);
break;
}
}
else
{
//controls for a touch screen. Selecting is different
switch (eMessageType(int(pVList->Get(0).GetFloat())))
{
case MESSAGE_TYPE_GUI_CLICK_START:
//HandleClickStart(pt);
OnUpdatePos(pt);
break;
case MESSAGE_TYPE_GUI_CLICK_END:
if (!m_bDisable)
{
OnUpdatePos(pt);
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
}
//HandleClickEnd(pt);
break;
case MESSAGE_TYPE_GUI_CLICK_MOVE:
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
OnUpdatePos(pt);
break;
}
}
}

View file

@ -3,112 +3,117 @@
#include "Entity/EntityUtils.h"
#include "DMODMenu.h"
#include "DMODInstallMenu.h"
#include "dink/dink.h"
#include "PopUpMenu.h"
void EnterURLMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
Entity *pMenu = pEntClicked->GetParent();
//LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[0].Print().c_str());
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
pEntClicked->GetParent()->RemoveComponentByName("FocusInput");
DisableAllButtonsEntity(pMenu);
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
DMODMenuCreate(pEntClicked->GetParent()->GetParent(), true);
}
if (pEntClicked->GetName() == "Continue")
{
string name = GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetVar("text")->GetString();
DisableAllButtonsEntity(pMenu);
GetApp()->GetVar("dmod_download_url")->Set(name); //save it to our database so we can remember the default
LogMsg("Read %s for the name", GetApp()->GetVar("name")->GetString().c_str());
#include "dink/dink.h"
#include "PopUpMenu.h"
void EnterURLMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
Entity *pMenu = pEntClicked->GetParent();
//LogMsg("Clicked %s entity at %s", pEntClicked->GetName().c_str(),pVList->m_variant[0].Print().c_str());
if (pEntClicked->GetName() == "Back")
{
//slide it off the screen and then kill the whole menu tree
pEntClicked->GetParent()->RemoveComponentByName("FocusInput");
DisableAllButtonsEntity(pMenu);
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
DMODInstallMenuCreate(pEntClicked->GetParent()->GetParent(), GetApp()->GetVar("dmod_download_url")->GetString(), GetDMODRootPath() );
}
if (pEntClicked->GetName() == "paste")
{
string text = GetClipboardText();
if (!text.empty())
{
GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetVar("text")->Set(""); //clear it first
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
DMODMenuCreate(pEntClicked->GetParent()->GetParent(), true);
}
if (pEntClicked->GetName() == "Continue")
{
string name = GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetVar("text")->GetString();
DisableAllButtonsEntity(pMenu);
GetApp()->GetVar("dmod_download_url")->Set(name); //save it to our database so we can remember the default
LogMsg("Read %s for the name", GetApp()->GetVar("name")->GetString().c_str());
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
DMODInstallMenuCreate(pEntClicked->GetParent()->GetParent(), GetApp()->GetVar("dmod_download_url")->GetString(), GetDMODRootPath() );
}
if (pEntClicked->GetName() == "paste")
{
string text = GetClipboardText();
if (!text.empty())
{
GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetVar("text")->Set(""); //clear it first
GetMessageManager()->SendGUI(MESSAGE_TYPE_GUI_PASTE, Variant(text), 0);
} else
{
//kill the keyboard
GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetFunction("CloseKeyboard")->sig_function(NULL);
PopUpCreate(pMenu, "Paste buffer is currently empty.", "", "cancel", "Continue", "", "", false);
}
}
}
Entity * EnterURLMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "EnterURLMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
} else
{
//kill the keyboard
GetEntityRoot()->GetEntityByName("name_input_box")->GetComponentByName("InputTextRender")->GetFunction("CloseKeyboard")->sig_function(NULL);
PopUpCreate(pMenu, "Paste buffer is currently empty.", "", "cancel", "Continue", "", "", false);
}
}
}
Entity * EnterURLMenuCreate(Entity *pParentEnt)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "EnterURLMenu", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
AddFocusIfNeeded(pBG);
Entity *pButtonEntity;
CL_Vec2f vTextAreaPos = iPhoneMap(25,40);
CL_Vec2f vTextAreaBounds = iPhoneMap(384,234);
string title = "`$Add-On Download from URL";
string title = "`$Add-On Download from URL";
pButtonEntity = CreateTextLabelEntity(pBG, "title", vTextAreaPos.x, vTextAreaPos.y, title);
pButtonEntity->GetComponentByName("TextRender")->GetVar("font")->Set(uint32(FONT_LARGE));
pButtonEntity->GetVar("scale2d")->Set(CL_Vec2f(0.6f, 0.6f));
vTextAreaPos.y += iPhoneMapY(25);
string msg = "Enter a URL to a .dmod file to download and install. (example: http://rtsoft.com/NewQuest.dmod )";
switch (GetEmulatedPlatformID())
{
case PLATFORM_ID_WINDOWS:
msg = "Enter a URL to a .dmod file to download and install. (example: http://rtsoft.com/NewQuest.dmod ) Use Ctrl-V to paste from the clipboard.";
break;
}
Entity *pText = CreateTextBoxEntity(pBG, "text", vTextAreaPos, vTextAreaBounds, msg);
pButtonEntity->GetVar("scale2d")->Set(CL_Vec2f(0.6f, 0.6f));
vTextAreaPos.y += iPhoneMapY(25);
string msg = "Enter a URL to a .dmod file to download and install. (example: http://rtsoft.com/NewQuest.dmod )";
switch (GetEmulatedPlatformID())
{
case PLATFORM_ID_WINDOWS:
msg = "Enter a URL to a .dmod file to download and install. (example: http://rtsoft.com/NewQuest.dmod ) Use Ctrl-V to paste from the clipboard.";
break;
}
Entity *pText = CreateTextBoxEntity(pBG, "text", vTextAreaPos, vTextAreaBounds, msg);
pButtonEntity = CreateTextButtonEntity(pBG, "Back", iPhoneMapX(25), iPhoneMapY(284), "Back", false);
pButtonEntity->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
pButtonEntity->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
//the continue button
pButtonEntity = CreateTextButtonEntity(pBG, "Continue", iPhoneMapX(356), iPhoneMapY(284), "Continue", false);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
//create button for pasting
if (GetEmulatedPlatformID() != PLATFORM_ID_WEBOS)
{
pButtonEntity = CreateTextButtonEntity(pBG, "paste", vTextAreaPos.x, vTextAreaPos.y+iPhoneMapX(80), "[tap here to paste]");
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
}
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&EnterURLMenuOnSelect);
}
//create input box
pButtonEntity = CreateInputTextEntity(pBG, "name_input_box", vTextAreaPos.x, vTextAreaPos.y+iPhoneMapX(49), GetApp()->GetShared()->GetVarWithDefault("dmod_download_url", string(""))->GetString(),
iPhoneMapX(450), 0);
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("inputLengthMax")->Set(uint32(255));
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("filtering")->Set(uint32(InputTextRenderComponent::FILTERING_LOOSE));
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("inputType")->Set(uint32(InputTextRenderComponent::INPUT_TYPE_URL));
pButtonEntity = CreateInputTextEntity(pBG, "name_input_box", vTextAreaPos.x, vTextAreaPos.y+iPhoneMapX(49), GetApp()->GetShared()->GetVarWithDefault("dmod_download_url", string(""))->GetString(),
iPhoneMapX(450), 0);
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("inputLengthMax")->Set(uint32(255));
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("filtering")->Set(uint32(InputTextRenderComponent::FILTERING_LOOSE));
pButtonEntity->GetComponentByName("InputTextRender")->GetVar("inputType")->Set(uint32(InputTextRenderComponent::INPUT_TYPE_URL));
//pButtonEntity->GetComponentByName("InputTextRender")->GetVar("font")->Set(uint32(FONT_LARGE));
if (IsDesktop())
pButtonEntity->GetComponentByName("InputTextRender")->GetFunction("ActivateKeyboard")->sig_function(NULL); //give it focus
//a way to get our CreateTextBox function called in 500 seconds, but not called if the entity doesn't exist at that time
//a way to get our CreateTextBox function called in 500 seconds, but not called if the entity doesn't exist at that time
SlideScreen(pBG, true);
return pBG;
}
return pBG;
}

View file

@ -958,6 +958,8 @@ void OnGameMenuRender(VariantList *pVList)
glMatrixMode(GL_MODELVIEW);
//well, we might as well always clear the BG, because some dmods like redink1 set transparency in the status bar which causes glitches if we don't
if (g_dglo.GetActiveView() != DinkGlobals::VIEW_ZOOMED)
{
//clear background if needed
@ -1026,17 +1028,26 @@ void OnArcadeInput(VariantList *pVList)
{
if (bIsDown)
{
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING)
{
string fName = DinkGetSavePath()+"quicksave.dat";
if (FileExists(fName))
{
LoadStateWithExtra();
} else
{
ShowQuickMessage("No state to load yet.");
}
string fName = DinkGetSavePath() + "quicksave.dat";
if (FileExists(fName))
{
LoadStateWithExtra();
}
else
{
ShowQuickMessage("No state to load yet.");
}
}
else
{
ShowQuickMessage("(can't load state yet, still loading game!)");
}
}
}
break;

View file

@ -756,10 +756,35 @@ void DrawCollision()
bool LoadTileScreenIfNeeded(int h, bool &bRequireRebuild)
{
bRequireRebuild = false;
if (g_tileScreens[h]) return true; //already loaded
string fName = "tiles/ts";
if (h < 10) fName += "0";
fName += toString(h)+".bmp";
if (g_tileScreens[h])
{
#ifdef _DEBUG
//LogMsg("tilescreen %s already loaded, skipping", fName.c_str());
#endif
#ifdef _DEBUG
if (g_tileScreens[h] && g_tileScreens[h]->m_pSurf->GetSurfaceType() != SoftSurface::SURFACE_PALETTE_8BIT)
{
//we're going to require a hicolor backbuffer.
if (lpDDSBackGround->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_PALETTE_8BIT)
{
LogMsg("BIG ERROR: Detected high color tilescreen bmps. Converting backbuffers to 32 bit on the fly.");
}
}
#endif
return true; //already loaded
}
assert(!g_tileScreens[h]);
#ifdef _DEBUG
LogMsg("Loading tilescreen %s", fName.c_str());
@ -1843,6 +1868,13 @@ void ReadFromLoadSequenceString(char ev[15][100] )
assert(strlen(ev[2]) < C_SPRITE_MAX_FILENAME_SIZE);
strcpy(g_dglos.g_seq[seqID].m_fileName, ev[2]);
#ifdef _DEBUG
if (seqID == 423)
{
LogMsg("He");
}
#endif
if (compare(ev[4], "BLACK"))
{
g_dglos.g_seq[seqID].m_transType = TRANSPARENT_BLACK;
@ -1854,12 +1886,7 @@ void ReadFromLoadSequenceString(char ev[15][100] )
}else if (compare(ev[4], "NOTANIM") /*|| compare(ev[4], "NOTANIN")*/ ) //to work around a typo in MsDink's DMOD, but not to work around the notanin error in seq 424 in original dini.ini's.. yeah, complicated. Why!?!?
{
#ifdef _DEBUG
if (seqID == 424)
{
LogMsg("He");
}
#endif
g_dglos.g_seq[seqID].m_transType = GetTransparencyOverrideForSequence(TRANSPARENT_WHITE, seqID);
} else
{
@ -2487,6 +2514,24 @@ void draw_status_all(void)
}
bool SwitchToRGBAIfNeeded(LPDIRECTDRAWSURFACE *pDXSurf, SoftSurface *pSoftSurf)
{
if ( (*pDXSurf) || (*pDXSurf)->m_pSurf) return false;
if ( (*pDXSurf)->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_PALETTE_8BIT
&&
(pSoftSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA
|| pSoftSurf->GetSurfaceType() == SoftSurface::SURFACE_RGB)
)
{
delete *pDXSurf;
*pDXSurf = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true);
return true;
}
return false;
}
void BlitGUIOverlay()
{
@ -2538,6 +2583,22 @@ void BlitGUIOverlay()
if (!check_seq_status(180)) return;
/*
if (lpDDSBack && lpDDSBack->m_pSurf && lpDDSBack->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_PALETTE_8BIT
&& g_pSpriteSurface[g_dglos.g_seq[180].frame[3]]->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA
|| g_pSpriteSurface[g_dglos.g_seq[180].frame[3]]->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA)
{
LogMsg("Freak out!");
//delete lpDDSBuffer;
//lpDDSBuffer = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true);
}
SwitchToRGBAIfNeeded(&lpDDSBack, g_pSpriteSurface[g_dglos.g_seq[180].frame[1]]->m_pSurf);
SwitchToRGBAIfNeeded(&lpDDSBack, g_pSpriteSurface[g_dglos.g_seq[180].frame[2]]->m_pSurf);
SwitchToRGBAIfNeeded(&lpDDSBack, g_pSpriteSurface[g_dglos.g_seq[180].frame[3]]->m_pSurf);
*/
lpDDSBack->BltFast( 0, 400, g_pSpriteSurface[g_dglos.g_seq[180].frame[3]], &rcRect , DDBLTFAST_NOCOLORKEY );
rcRect.left = 0;
rcRect.top = 0;
@ -5460,6 +5521,12 @@ void CopyBitmapToBackBuffer (char *pName)
LogMsg("Error: Can't find bitmap at %s.",fName.c_str());
return;
}
if (lpDDSBuffer && lpDDSBuffer->m_pSurf && lpDDSBuffer->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA || lpDDSBuffer->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGB)
{
LogMsg("Warning, losing high color back buffer");
//assert(0);
}
SAFE_DELETE(lpDDSBuffer);
assert(!lpDDSBuffer);
lpDDSBuffer = LoadBitmapIntoSurface(fName.c_str(), TRANSPARENT_NONE);
@ -5498,7 +5565,14 @@ void copy_bmp( char *pName)
LogMsg("Error: Can't find bitmap at %s.",fName.c_str());
return;
}
SAFE_DELETE(lpDDSBuffer);
if (lpDDSBuffer && lpDDSBuffer->m_pSurf && lpDDSBuffer->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA || lpDDSBuffer->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGB)
{
LogMsg("Warning, losing high color back buffer");
assert(0);
}
SAFE_DELETE(lpDDSBuffer);
assert(!lpDDSBuffer);
lpDDSBuffer = LoadBitmapIntoSurface(fName.c_str(), TRANSPARENT_NONE);
@ -5509,6 +5583,7 @@ SAFE_DELETE(lpDDSBuffer);
ddrval = lpDDSBack->BltFast( 0, 0, lpDDSBuffer,
&rcRect, DDBLTFAST_NOCOLORKEY);
assert(!"Clear this?");
ddrval = lpDDSBackGround->BltFast( 0, 0, lpDDSBuffer,
&rcRect, DDBLTFAST_NOCOLORKEY);
@ -5888,6 +5963,9 @@ void BuildScreenBackground( bool bFullRebuild )
if (bFullRebuild)
{
#ifdef _DEBUG
LogMsg("Doing full rebuild of screen background...");
#endif
while (kill_last_sprite());
kill_repeat_sounds();
kill_all_scripts();
@ -14309,7 +14387,16 @@ fin:
CL_Vec2f NativeToDinkCoords(CL_Vec2f vPos)
{
return CL_Vec2f( g_dglo.m_orthoRenderRect.left+ vPos.x * g_dglo.m_orthoRenderRect.GetWidth()/GetScreenSizeXf(), vPos.y *g_dglo.m_orthoRenderRect.GetHeight()/GetScreenSizeYf());
CL_Vec2f r = CL_Vec2f(
g_dglo.m_orthoRenderRect.left + vPos.x * (g_dglo.m_orthoRenderRect.GetWidth() / GetScreenSizeXf()),
vPos.y * (g_dglo.m_orthoRenderRect.GetHeight() / GetScreenSizeYf())
);
r.x /= g_dglo.m_aspectRatioModX;
r.y /= g_dglo.m_aspectRatioModY;
r -= g_dglo.m_centeringOffset;
return r;
}
@ -15343,6 +15430,8 @@ if (IsDesktop())
ProcessGraphicGarbageCollection();
//620
SetOrthoRenderSize(g_dglo.m_orthoRenderRect.right, g_dglo.m_orthoRenderRect.GetHeight(), -g_dglo.m_orthoRenderRect.left, -g_dglo.m_orthoRenderRect.top);
if (5 > 9)
{
@ -15351,6 +15440,7 @@ if (IsDesktop())
bCaptureScreen = true;
}
check_joystick();
#ifdef C_DINK_KEYBOARD_INPUT
@ -15482,8 +15572,11 @@ LastWindowsTimer = GetTickCount();
if (*pupdate_status == 1) update_status_all();
update_sound();
//TODO Animated tiles
if (IsDesktop())
//if (IsDesktop())
{
//TODO: Maybe mobile can handle this now?
process_animated_tiles();
@ -15510,6 +15603,7 @@ LastWindowsTimer = GetTickCount();
ProcessTransition();
if (g_dglos.process_upcycle)
{
up_cycle();
@ -15569,7 +15663,13 @@ LastWindowsTimer = GetTickCount();
//Blit from Two, which holds the base scene.
lpDDSBack->BltFast( 0, 0, lpDDSBackGround, &rcRect, DDBLTFAST_NOCOLORKEY);
// lpDDSBack->BltFast( 0, 0, lpDDSBackGround, &rcRect, DDBLTFAST_NOCOLORKEY);
rtRect32 rcRectGameArea(g_dglo.m_gameArea.left, g_dglo.m_gameArea.top, g_dglo.m_gameArea.right, g_dglo.m_gameArea.bottom);
lpDDSBack->BltFast(g_dglo.m_gameArea.left, g_dglo.m_gameArea.top, lpDDSBackGround,
&rcRectGameArea, DDBLTFAST_NOCOLORKEY);
g_dglo.m_bgSpriteMan.Render(lpDDSBack); //blit sprites that have been shoved into the bg, too slow to actually add them, so we fake it until the screen is rebuilt
if (!g_bTransitionActive)
@ -16002,6 +16102,7 @@ bool LoadGameChunk(int gameIDToLoad, float &progressOut)
//init back buffer at 8 bit, if highcolor is needed later it will auto convert
lpDDSBackGround = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, false);
fill_screen(0); //fill background with blank to start things off
lpDDSBuffer = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL);
@ -16953,7 +17054,7 @@ void ApplyAspectRatioGLMatrix()
CL_Mat4f mat;
glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0]);
g_dglo.m_dink_matrix = mat;
//OPTIMIZE - All this can be cached... maybe done in RecomputeAspectRatio()
mat.inverse();
@ -17025,8 +17126,13 @@ void DinkReInitSurfacesAfterVideoChange()
{
g_transitionSurf.HardKill();
//CheckTransitionSurface();
bool bHighColor = false;
if (lpDDSBackGround && lpDDSBackGround->m_pSurf && lpDDSBackGround->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA)
bHighColor = true;
SAFE_DELETE(lpDDSBackGround);
lpDDSBackGround = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, false);
lpDDSBackGround = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, bHighColor);
g_onePixelSurf.HardKill();
}

View file

@ -146,6 +146,7 @@ public:
float m_aspectRatioModX;
float m_aspectRatioModY;
CL_Vec3f m_centeringOffset;
CL_Mat4f m_dink_matrix;
};
//#define KYLES_CRAZY_VERSION

View file

@ -48,6 +48,8 @@ enum eTransparencyType
};
//blt flags
#define DDBLT_KEYSRC 0x00008000l
#define DDBLT_COLORFILL 0x00000400l