SetObjectBlitMode

Category: Objects / Display
Since engine version: 4.9.5.0 CE (extended in 4.9.6.0 CR)

Description

Changes the drawing mode of an object. The possible values correspond to the BlitMode value in the DefCore (see notice). This function returns the previously set blit mode.

Syntax

int SetObjectBlitMode (int dwNewBlitMod, object pObj, int iOverlayID);

Parameters

dwNewBlitMod:
[opt] New drawing mode (values see below). If 0 the object is reset to its definition blit mode. Otherwise bit 8 (user defined color value) is set implicitly.
pObj:
[opt] Object for which you want to change the drawing mode. Can be 0 in local calls.
iOverlayID:
[opt] If specified, this will change the blit mode of the graphics overlay instead. The overlay must have been created using SetGraphics first. From CR.

Remarks

The blit mode does not affect additional overlay graphics. The blit mode of those must be set using SetGraphics.
Constant Value Meaning
GFX_BLIT_Additive 1 Additive (always base surface and overlay)
GFX_BLIT_Mod2 2 Additive Modulation: the color of the modulation value is added to the object color, then RGB(128,128,128) is subtracted. Only base surface.
GFX_BLIT_ClrSfc_OwnClr 4 The color modulation set via SetClrModulation() applies to the base surface only and the overlay is normally colored by the owner color (see SetColorDw()).
GFX_BLIT_ClrSfc_Mod2 8 The overlay (owner color) is drawn using additive modulation. This flag might have to be set independently of bit 2.
5-7 16, 32, 64 reserved
GFX_BLIT_Custom 128 User defined color value. This value can be specified if no special color mode is desired and to overwrite a DefCore setting. Also, this bit is set in the return value of this function and GetObjectBlitMode if the current blit mode of the object does not correspond to the definition blit mode.
GFX_BLIT_Parent 256 Only for overlays: the blit mode of the base surface is used when drawing this overlay. From CR.

Example

static g_pCursor, g_dwPrevBlitMode, g_dwPrevMod;

protected func Script100()
  {
  // Ausgewählten Clonk des ersten Spielers ermitteln
  g_pCursor = GetCursor();
  // Vorherige Werte speichern
  g_dwPrevBlitMode = GetObjectBlitMode(g_pCursor);
  g_dwPrevMod = GetClrModulation(g_pCursor);
  // Nicht-ColorByOwner-Teile des Clonks leuchtend grün färben
  SetObjectBlitMode(6, g_pCursor);
  SetClrModulation(RGB(100, 255, 110), g_pCursor);
  // Nachricht
  Message("Schau her, ich kann leuchten!", g_pCursor);
  return(1);
  }

protected func Script200()
  {
  // Farbe zurücksetzen
  SetObjectBlitMode(g_dwPrevBlitMode, g_pCursor);
  SetClrModulation(g_dwPrevMod, g_pCursor);
  // Nachricht
  Message("Schon vorbei :\", g_pCursor);
  "return(1);
  }
Part of a scenario script: colors the selected clonk of the first player bright green for a while.
To handle the timing properly, it would be better to use an effect in order to avoid conflicts with other scripts that might change the color at the same time.
See also: GetObjectBlitMode, SetClrModulation
Sven2, März 2004