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

@ -45,4 +45,12 @@ www.rtsoft.com
------ Change log for 1.7.1 ----------
(big thanks to Redink1 for most of these bug reports!)
* (Windows) Fixed app icon
* (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

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

@ -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,10 +65,50 @@ 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));
if (IsDesktop())
{
//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;
}
}
else
{
//controls for a touch screen. Selecting is different
switch (eMessageType(int(pVList->Get(0).GetFloat())))
{
case MESSAGE_TYPE_GUI_CLICK_START:
@ -83,5 +130,8 @@ void CursorComponent::OnInput( VariantList *pVList )
OnUpdatePos(pt);
break;
}
}
}

View file

@ -105,6 +105,11 @@ if (GetEmulatedPlatformID() != PLATFORM_ID_WEBOS)
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
SlideScreen(pBG, true);

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,6 +1028,9 @@ void OnArcadeInput(VariantList *pVList)
{
if (bIsDown)
{
if (GetDinkGameState() == DINK_GAME_STATE_PLAYING)
{
string fName = DinkGetSavePath() + "quicksave.dat";
@ -1033,11 +1038,17 @@ void OnArcadeInput(VariantList *pVList)
if (FileExists(fName))
{
LoadStateWithExtra();
} else
}
else
{
ShowQuickMessage("No state to load yet.");
}
}
else
{
ShowQuickMessage("(can't load state yet, still loading game!)");
}
}
}
break;
case VIRTUAL_KEY_GAME_MAGIC:

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,6 +5565,13 @@ void copy_bmp( 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);
@ -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