- 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:
Christoph Oelckers 2015-12-06 09:59:02 +01:00
parent 81f521fe56
commit ad0e71942d
5 changed files with 23 additions and 4 deletions

View file

@ -134,6 +134,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
NoWrap = false; NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = 0; ClipX = ClipY = ClipWidth = ClipHeight = 0;
WrapWidth = 0; WrapWidth = 0;
HandleAspect = true;
Top = y; Top = y;
Next = NULL; Next = NULL;
Lines = NULL; Lines = NULL;
@ -196,6 +197,14 @@ void DHUDMessage::Serialize (FArchive &arc)
NoWrap = false; NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0; ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0;
} }
if (SaveVersion >= 4525)
{
arc << HandleAspect;
}
else
{
HandleAspect = true;
}
if (arc.IsLoading ()) if (arc.IsLoading ())
{ {
Lines = NULL; Lines = NULL;
@ -257,7 +266,7 @@ void DHUDMessage::CalcClipCoords(int hudheight)
else else
{ {
screen->VirtualToRealCoordsInt(x, y, w, h, screen->VirtualToRealCoordsInt(x, y, w, h,
HUDWidth, hudheight, false, true); HUDWidth, hudheight, false, HandleAspect);
ClipLeft = x; ClipLeft = x;
ClipTop = y; ClipTop = y;
ClipRight = x + w; ClipRight = x + w;

View file

@ -94,12 +94,13 @@ public:
NoWrap = nowrap; NoWrap = nowrap;
ResetText(SourceText); 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; ClipX = x;
ClipY = y; ClipY = y;
ClipWidth = width; ClipWidth = width;
ClipHeight = height; ClipHeight = height;
HandleAspect = aspect;
} }
void SetWrapWidth(int wrap) void SetWrapWidth(int wrap)
{ {
@ -119,6 +120,7 @@ protected:
int HUDWidth, HUDHeight; int HUDWidth, HUDHeight;
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
bool HandleAspect;
EColorRange TextColor; EColorRange TextColor;
FFont *Font; FFont *Font;
FRenderStyle Style; FRenderStyle Style;

View file

@ -4442,6 +4442,7 @@ enum EACSFunctions
ACSF_GetActorRoll, ACSF_GetActorRoll,
ACSF_QuakeEx, ACSF_QuakeEx,
ACSF_Warp, // 92 ACSF_Warp, // 92
ACSF_GetAspectRatio,
/* Zandronum's - these must be skipped when we reach 99! /* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0), -100:ResetMap(0),
@ -5315,6 +5316,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
ClipRectWidth = argCount > 2 ? args[2] : 0; ClipRectWidth = argCount > 2 ? args[2] : 0;
ClipRectHeight = argCount > 3 ? args[3] : 0; ClipRectHeight = argCount > 3 ? args[3] : 0;
WrapWidth = argCount > 4 ? args[4] : 0; WrapWidth = argCount > 4 ? args[4] : 0;
HandleAspect = argCount > 5 ? !!args[5] : true;
break; break;
case ACSF_SetHUDWrapWidth: case ACSF_SetHUDWrapWidth:
@ -5915,10 +5917,14 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return false; return false;
} }
case ACSF_GetAspectRatio:
return CheckRatio(screen->GetWidth(), screen->GetHeight());
default: default:
break; break;
} }
return 0; return 0;
} }
@ -7854,7 +7860,7 @@ scriptwait:
} }
break; break;
} }
msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight); msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight, HandleAspect);
if (WrapWidth != 0) if (WrapWidth != 0)
{ {
msg->SetWrapWidth(WrapWidth); msg->SetWrapWidth(WrapWidth);
@ -9466,6 +9472,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
activefont = SmallFont; activefont = SmallFont;
hudwidth = hudheight = 0; hudwidth = hudheight = 0;
ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0; ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0;
HandleAspect = true;
state = SCRIPT_Running; state = SCRIPT_Running;
// Hexen waited one second before executing any open scripts. I didn't realize // Hexen waited one second before executing any open scripts. I didn't realize

View file

@ -891,6 +891,7 @@ protected:
int hudwidth, hudheight; int hudwidth, hudheight;
int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight; int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight;
int WrapWidth; int WrapWidth;
bool HandleAspect;
FBehavior *activeBehavior; FBehavior *activeBehavior;
int InModuleScriptNumber; int InModuleScriptNumber;

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4524 #define SAVEVER 4525
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)