mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 14:12:28 +00:00
Merge remote-tracking branch 'gz/master' into thereisnospoon
This commit is contained in:
commit
b7e64a2bc5
9 changed files with 87 additions and 24 deletions
|
@ -975,7 +975,7 @@ public:
|
|||
{
|
||||
SetOrigin(Pos() + vel, true);
|
||||
}
|
||||
void SetOrigin(double x, double y, double z, bool moving);
|
||||
virtual void SetOrigin(double x, double y, double z, bool moving);
|
||||
void SetOrigin(const DVector3 & npos, bool moving)
|
||||
{
|
||||
SetOrigin(npos.X, npos.Y, npos.Z, moving);
|
||||
|
|
|
@ -867,6 +867,14 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
|||
// This should be done after postprocessing, not before.
|
||||
mBuffers->BindCurrentFB();
|
||||
glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height);
|
||||
|
||||
if (!toscreen)
|
||||
{
|
||||
gl_RenderState.mViewMatrix.loadIdentity();
|
||||
gl_RenderState.mProjectionMatrix.ortho(mScreenViewport.left, mScreenViewport.width, mScreenViewport.height, mScreenViewport.top, -1.0f, 1.0f);
|
||||
gl_RenderState.ApplyMatrices();
|
||||
}
|
||||
|
||||
DrawBlend(lviewsector);
|
||||
}
|
||||
mDrawingScene2D = false;
|
||||
|
|
|
@ -3197,6 +3197,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
|
||||
// spawn it
|
||||
mo = AActor::StaticSpawn(mobj->GetClass(), DVector3(mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z), NO_REPLACE, true);
|
||||
mo->health = mobj->SpawnHealth();
|
||||
|
||||
if (z == ONFLOORZ)
|
||||
{
|
||||
|
|
|
@ -1136,4 +1136,48 @@ DEFINE_ACTION_FUNCTION(FStringStruct, AppendFormat)
|
|||
FString s = FStringFormat(param+1, defaultparam, numparam-1, ret, numret);
|
||||
(*self) += s;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FStringStruct, Mid)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_INT(pos);
|
||||
PARAM_INT(len);
|
||||
// validate. we don't want to crash if someone passes negative values.
|
||||
// with size_t it's handled naturally I think, as it's unsigned, but not in ZScript.
|
||||
if (pos < 0) pos = 0;
|
||||
if (len < 0) len = 0;
|
||||
int slen = self->Len();
|
||||
if (pos > slen) pos = slen - 1;
|
||||
if (pos + len > slen)
|
||||
len = slen - pos;
|
||||
FString s = self->Mid(pos, len);
|
||||
ACTION_RETURN_STRING(s);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FStringStruct, Len)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
ACTION_RETURN_INT(self->Len());
|
||||
}
|
||||
|
||||
// CharAt and CharCodeAt is how JS does it, and JS is similar here in that it doesn't have char type as int.
|
||||
DEFINE_ACTION_FUNCTION(FStringStruct, CharAt)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_INT(pos);
|
||||
int slen = self->Len();
|
||||
if (pos < 0 || pos >= slen)
|
||||
ACTION_RETURN_STRING("");
|
||||
ACTION_RETURN_STRING(FString((*self)[pos]));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FStringStruct, CharCodeAt)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_INT(pos);
|
||||
int slen = self->Len();
|
||||
if (pos < 0 || pos >= slen)
|
||||
ACTION_RETURN_INT(0);
|
||||
ACTION_RETURN_INT((*self)[pos]);
|
||||
}
|
||||
|
|
|
@ -129,12 +129,12 @@ static int PalFromRGB(uint32 rgb)
|
|||
|
||||
void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...)
|
||||
{
|
||||
va_list tags;
|
||||
va_start(tags, tags_first);
|
||||
Va_List tags;
|
||||
va_start(tags.list, tags_first);
|
||||
DrawParms parms;
|
||||
|
||||
bool res = ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, false);
|
||||
va_end(tags);
|
||||
va_end(tags.list);
|
||||
if (!res)
|
||||
{
|
||||
return;
|
||||
|
@ -457,30 +457,30 @@ bool DCanvas::SetTextureParms(DrawParms *parms, FTexture *img, double xx, double
|
|||
return false;
|
||||
}
|
||||
|
||||
static void ListEnd(va_list &tags)
|
||||
static void ListEnd(Va_List &tags)
|
||||
{
|
||||
va_end(tags);
|
||||
va_end(tags.list);
|
||||
}
|
||||
|
||||
static int ListGetInt(va_list &tags)
|
||||
static int ListGetInt(Va_List &tags)
|
||||
{
|
||||
return va_arg(tags, int);
|
||||
return va_arg(tags.list, int);
|
||||
}
|
||||
|
||||
static inline double ListGetDouble(va_list &tags)
|
||||
static inline double ListGetDouble(Va_List &tags)
|
||||
{
|
||||
return va_arg(tags, double);
|
||||
return va_arg(tags.list, double);
|
||||
}
|
||||
|
||||
// These two options are only being used by the D3D version of the HUD weapon drawer, they serve no purpose anywhere else.
|
||||
static inline FSpecialColormap * ListGetSpecialColormap(va_list &tags)
|
||||
static inline FSpecialColormap * ListGetSpecialColormap(Va_List &tags)
|
||||
{
|
||||
return va_arg(tags, FSpecialColormap *);
|
||||
return va_arg(tags.list, FSpecialColormap *);
|
||||
}
|
||||
|
||||
static inline FColormapStyle * ListGetColormapStyle(va_list &tags)
|
||||
static inline FColormapStyle * ListGetColormapStyle(Va_List &tags)
|
||||
{
|
||||
return va_arg(tags, FColormapStyle *);
|
||||
return va_arg(tags.list, FColormapStyle *);
|
||||
}
|
||||
|
||||
static void ListEnd(VMVa_List &tags)
|
||||
|
@ -946,7 +946,7 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag,
|
|||
}
|
||||
// explicitly instantiate both versions for v_text.cpp.
|
||||
|
||||
template bool DCanvas::ParseDrawTextureTags<va_list>(FTexture *img, double x, double y, DWORD tag, va_list& tags, DrawParms *parms, bool fortext) const;
|
||||
template bool DCanvas::ParseDrawTextureTags<Va_List>(FTexture *img, double x, double y, DWORD tag, Va_List& tags, DrawParms *parms, bool fortext) const;
|
||||
template bool DCanvas::ParseDrawTextureTags<VMVa_List>(FTexture *img, double x, double y, DWORD tag, VMVa_List& tags, DrawParms *parms, bool fortext) const;
|
||||
|
||||
void DCanvas::VirtualToRealCoords(double &x, double &y, double &w, double &h,
|
||||
|
|
|
@ -71,10 +71,10 @@ void DCanvas::DrawChar (FFont *font, int normalcolor, double x, double y, int ch
|
|||
if (NULL != (pic = font->GetChar (character, &dummy)))
|
||||
{
|
||||
DrawParms parms;
|
||||
va_list tags;
|
||||
va_start(tags, tag_first);
|
||||
Va_List tags;
|
||||
va_start(tags.list, tag_first);
|
||||
bool res = ParseDrawTextureTags(pic, x, y, tag_first, tags, &parms, false);
|
||||
va_end(tags);
|
||||
va_end(tags.list);
|
||||
if (!res)
|
||||
{
|
||||
return;
|
||||
|
@ -197,15 +197,15 @@ void DCanvas::DrawTextCommon(FFont *font, int normalcolor, double x, double y, c
|
|||
|
||||
void DCanvas::DrawText(FFont *font, int normalcolor, double x, double y, const char *string, int tag_first, ...)
|
||||
{
|
||||
va_list tags;
|
||||
Va_List tags;
|
||||
DrawParms parms;
|
||||
|
||||
if (font == NULL || string == NULL)
|
||||
return;
|
||||
|
||||
va_start(tags, tag_first);
|
||||
va_start(tags.list, tag_first);
|
||||
bool res = ParseDrawTextureTags(nullptr, 0, 0, tag_first, tags, &parms, true);
|
||||
va_end(tags);
|
||||
va_end(tags.list);
|
||||
if (!res)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -1396,7 +1396,7 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real
|
|||
cy1 = MAX(cheight / designheight, 1);
|
||||
cx2 = MAX(realwidth / designwidth, 1);
|
||||
cy2 = MAX(realheight / designheight, 1);
|
||||
if (abs(cx1 - cy1) <= abs(cx2 - cy2))
|
||||
if (abs(cx1 - cy1) <= abs(cx2 - cy2) || cx1 >= 4)
|
||||
{ // e.g. 640x360 looks better with this.
|
||||
*cleanx = cx1;
|
||||
*cleany = cy1;
|
||||
|
|
|
@ -177,6 +177,11 @@ struct DrawParms
|
|||
bool virtBottom;
|
||||
};
|
||||
|
||||
struct Va_List
|
||||
{
|
||||
va_list list;
|
||||
};
|
||||
|
||||
struct VMVa_List
|
||||
{
|
||||
VMValue *args;
|
||||
|
|
|
@ -418,9 +418,14 @@ enum EPickStart
|
|||
// Although String is a builtin type, this is a convenient way to attach methods to it.
|
||||
struct StringStruct native
|
||||
{
|
||||
native void Replace(String pattern, String replacement);
|
||||
native static vararg String Format(String fmt, ...);
|
||||
native vararg void AppendFormat(String fmt, ...);
|
||||
|
||||
native void Replace(String pattern, String replacement);
|
||||
native String Mid(int pos = 0, int len = 2147483647);
|
||||
native int Len();
|
||||
native String CharAt(int pos);
|
||||
native int CharCodeAt(int pos);
|
||||
}
|
||||
|
||||
class Floor : Thinker native
|
||||
|
|
Loading…
Reference in a new issue