39 void C4GameMessage::Init(int32_t iType,
const StdStrBuf & sText,
C4Object *pTarget, int32_t iPlayer, int32_t iX, int32_t iY, uint32_t dwClr,
C4ID idDecoID,
C4PropList *pSrc, uint32_t dwFlags,
int width)
42 if (pTarget && !pTarget->
Status) pTarget =
nullptr;
112 if (
Delay==0)
return false;
126 int32_t iTextWdt,iTextHgt;
137 if (!wdt) wdt = Clamp<int32_t>(cgo.
Wdt/2, 50, std::min<int32_t>(500, cgo.
Wdt-10));
139 wdt = std::min<int32_t>(wdt, iUnbrokenTextWidth+10);
144 wdt = Clamp<int32_t>(cgo.
Wdt-50, 50, 500);
146 wdt = Clamp<int32_t>(wdt, 10, cgo.
Wdt-10);
148 iTextWdt = wdt * cgo.
Zoom;
156 int32_t iDrawX = cgo.
X+x;
157 int32_t iDrawY = cgo.
Y+y;
170 iDrawX *= cgo.
Zoom; iDrawY *= cgo.
Zoom;
199 iDrawX += (cgo.
Wdt/2) * cgo.
Zoom;
200 iDrawY += (2 * cgo.
Hgt / 3 + 50) * cgo.
Zoom;
209 float iMsgX, iMsgY, newzoom;
228 int breakWdt = Clamp<int32_t>(cgo.
Wdt * cgo.
Zoom, 50, 200);
262 iTX = (iMsgX - cgo.
X) * newzoom;
263 iTY = (iMsgY - cgo.
Y) * newzoom;
273 iTY -= zoom * float(iTHgt);
275 iTY -= zoom * float(iTHgt/2);
277 iTY -= zoom * float(iTHgt);
280 iTX += 0.25f * float(iTWdt) * (1.0f - zoom);
329 for (cmsg=
First; cmsg; cmsg=next)
333 {
delete cmsg;
if (prev) prev->
Next=next;
else First=next; }
342 for (cmsg=
First; cmsg; cmsg=next)
353 for (cmsg=
First; cmsg; cmsg=next)
357 {
delete cmsg;
if (prev) prev->
Next=next;
else First=next; }
363 bool C4GameMessageList::New(int32_t iType,
const char *szText,
C4Object *pTarget, int32_t iPlayer, int32_t iX, int32_t iY, uint32_t dwClr,
C4ID idDecoID,
C4PropList *pSrc, uint32_t dwFlags, int32_t width)
365 return New(iType,
StdStrBuf(szText), pTarget, iPlayer, iX, iY, dwClr, idDecoID, pSrc, dwFlags, width);
368 bool C4GameMessageList::New(int32_t iType,
const StdStrBuf & sText,
C4Object *pTarget, int32_t iPlayer, int32_t iX, int32_t iY, uint32_t dwClr,
C4ID idDecoID,
C4PropList *pSrc, uint32_t dwFlags, int32_t width)
380 if (pTarget && !pTarget->
Status)
return false;
387 msgNew->
Init(iType, sText,pTarget,iPlayer,iX,iY,dwClr, idDecoID, pSrc, dwFlags, width);
400 if (pTarget == cmsg->
Target)
406 if (iPlayer == cmsg->
Player)
409 if (!cmsg || pTarget!=cmsg->
Target)
411 New(iType, szText, pTarget, iPlayer, iX, iY, bCol);
415 cmsg->
Append(szText, fNoDuplicates);
423 for (cmsg=
First; cmsg; cmsg=next)
427 {
delete cmsg;
if (prev) prev->
Next=next;
else First=next; }
445 cmsg->
Draw(gui_cgo,iPlayer);
447 cmsg->
Draw(cgo,iPlayer);
453 ::Messages.
New(
C4GM_TargetPlayer,szText,pTarget,pTarget->
Controller,0,0, Red ?
C4RGB(0xca, 0, 0) :
C4RGB(0xff, 0xff, 0xff));
const int32_t C4D_Foreground
const int32_t ObjectMsgDelayFactor
int32_t DrawMessageOffset
void GameMsgObjectError(const char *szText, C4Object *pTarget, bool Red)
const int32_t GlobalMsgDelayFactor
C4GameMessageList Messages
const int32_t C4GM_Bottom
const int32_t C4GM_NoBreak
const int32_t C4GM_Multiple
const int32_t C4GM_HCenter
const int32_t C4GM_VCenter
const int32_t C4GM_GlobalPlayer
const int32_t C4GM_PositioningFlags
const int32_t C4GM_TargetPlayer
const int32_t C4GM_MinDelay
const int32_t C4GM_WidthRel
const int32_t C4GM_Target
const int32_t C4GM_Global
C4GraphicsResource GraphicsResource
bool SEqual2(const char *szStr1, const char *szStr2)
const char * SAdvancePast(const char *szSPos, char cPast)
size_t SLen(const char *sptr)
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
bool SetByDef(C4Def *pSrcDef)
void Draw(C4TargetFacet &cgo, C4Rect &rcDrawArea)
bool DrawPropListSpecImage(C4Facet &target, C4PropList *spec)
int32_t GetPositioningFlags() const
C4GUI::FrameDecoration * pFrameDeco
void Init(int32_t iType, const StdStrBuf &Text, C4Object *pTarget, int32_t iPlayer, int32_t iX, int32_t iY, uint32_t dwCol, C4ID idDecoID, C4PropList *pSrc, uint32_t dwFlags, int width)
void UpdateDef(C4ID idUpdDef)
void Append(const char *szText, bool fNoDuplicates=false)
void Draw(C4TargetFacet &cgo, int32_t iPlayer)
bool Append(int32_t iType, const char *szText, C4Object *pTarget, int32_t iPlayer, int32_t iX, int32_t iY, uint32_t bCol, bool fNoDuplicates=false)
void Draw(C4TargetFacet &gui_cgo, C4TargetFacet &cgo, int32_t iPlayer)
void ClearPlayers(int32_t iPlayer, int32_t dwPositioningFlags)
bool New(int32_t iType, const StdStrBuf &Text, C4Object *pTarget, int32_t iPlayer, int32_t iX=-1, int32_t iY=-1, uint32_t dwClr=0xffFFFFFF, C4ID idDecoID=C4ID::None, C4PropList *pSrc=nullptr, uint32_t dwFlags=0u, int32_t width=0)
void ClearPointers(C4Object *pObj)
void UpdateDef(C4ID idUpdDef)
bool GetDrawPosition(const C4TargetFacet &cgo, float &resultx, float &resulty, float &resultzoom) const
void DrawPicture(C4Facet &cgo, bool fSelected=false, C4DrawTransform *transform=nullptr)
bool IsVisible(int32_t iForPlr, bool fAsOverlay) const
virtual C4Object * GetObject()
C4PropList * GetPropertyPropList(C4PropertyName k) const
virtual C4Def const * GetDef() const
bool GetProperty(C4PropertyName k, C4Value *pResult) const
void SetPropList(C4PropList *PropList)
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
std::tuple< std::string, int > BreakMessage(const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f)
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
void Move(size_t iFrom, size_t inSize, size_t iTo=0)
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
void Ref(const char *pnData)
void Shrink(size_t iShrink)
const char * getData() const