mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- added GetAspectRatio function to ACS.
- added a sixth parameter for SetHUDClipRect so that the forced aspect ratio fudging this function performs can be disabled.
This commit is contained in:
parent
81f521fe56
commit
ad0e71942d
5 changed files with 23 additions and 4 deletions
|
@ -134,6 +134,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
|
|||
NoWrap = false;
|
||||
ClipX = ClipY = ClipWidth = ClipHeight = 0;
|
||||
WrapWidth = 0;
|
||||
HandleAspect = true;
|
||||
Top = y;
|
||||
Next = NULL;
|
||||
Lines = NULL;
|
||||
|
@ -196,6 +197,14 @@ void DHUDMessage::Serialize (FArchive &arc)
|
|||
NoWrap = false;
|
||||
ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0;
|
||||
}
|
||||
if (SaveVersion >= 4525)
|
||||
{
|
||||
arc << HandleAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleAspect = true;
|
||||
}
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
Lines = NULL;
|
||||
|
@ -257,7 +266,7 @@ void DHUDMessage::CalcClipCoords(int hudheight)
|
|||
else
|
||||
{
|
||||
screen->VirtualToRealCoordsInt(x, y, w, h,
|
||||
HUDWidth, hudheight, false, true);
|
||||
HUDWidth, hudheight, false, HandleAspect);
|
||||
ClipLeft = x;
|
||||
ClipTop = y;
|
||||
ClipRight = x + w;
|
||||
|
|
|
@ -94,12 +94,13 @@ public:
|
|||
NoWrap = nowrap;
|
||||
ResetText(SourceText);
|
||||
}
|
||||
void SetClipRect(int x, int y, int width, int height)
|
||||
void SetClipRect(int x, int y, int width, int height, bool aspect)
|
||||
{
|
||||
ClipX = x;
|
||||
ClipY = y;
|
||||
ClipWidth = width;
|
||||
ClipHeight = height;
|
||||
HandleAspect = aspect;
|
||||
}
|
||||
void SetWrapWidth(int wrap)
|
||||
{
|
||||
|
@ -119,6 +120,7 @@ protected:
|
|||
int HUDWidth, HUDHeight;
|
||||
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
|
||||
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
|
||||
bool HandleAspect;
|
||||
EColorRange TextColor;
|
||||
FFont *Font;
|
||||
FRenderStyle Style;
|
||||
|
|
|
@ -4442,6 +4442,7 @@ enum EACSFunctions
|
|||
ACSF_GetActorRoll,
|
||||
ACSF_QuakeEx,
|
||||
ACSF_Warp, // 92
|
||||
ACSF_GetAspectRatio,
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
|
@ -5315,6 +5316,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
|
|||
ClipRectWidth = argCount > 2 ? args[2] : 0;
|
||||
ClipRectHeight = argCount > 3 ? args[3] : 0;
|
||||
WrapWidth = argCount > 4 ? args[4] : 0;
|
||||
HandleAspect = argCount > 5 ? !!args[5] : true;
|
||||
break;
|
||||
|
||||
case ACSF_SetHUDWrapWidth:
|
||||
|
@ -5915,10 +5917,14 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
return false;
|
||||
}
|
||||
|
||||
case ACSF_GetAspectRatio:
|
||||
return CheckRatio(screen->GetWidth(), screen->GetHeight());
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7854,7 +7860,7 @@ scriptwait:
|
|||
}
|
||||
break;
|
||||
}
|
||||
msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight);
|
||||
msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight, HandleAspect);
|
||||
if (WrapWidth != 0)
|
||||
{
|
||||
msg->SetWrapWidth(WrapWidth);
|
||||
|
@ -9466,6 +9472,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
|||
activefont = SmallFont;
|
||||
hudwidth = hudheight = 0;
|
||||
ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0;
|
||||
HandleAspect = true;
|
||||
state = SCRIPT_Running;
|
||||
|
||||
// Hexen waited one second before executing any open scripts. I didn't realize
|
||||
|
|
|
@ -891,6 +891,7 @@ protected:
|
|||
int hudwidth, hudheight;
|
||||
int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight;
|
||||
int WrapWidth;
|
||||
bool HandleAspect;
|
||||
FBehavior *activeBehavior;
|
||||
int InModuleScriptNumber;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ const char *GetVersionString();
|
|||
|
||||
// Use 4500 as the base git save version, since it's higher than the
|
||||
// SVN revision ever got.
|
||||
#define SAVEVER 4524
|
||||
#define SAVEVER 4525
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
Loading…
Reference in a new issue