SetObjectBlitMode

Category: Objects / Display
Since engine version: 1.0 OC

Description

Changes the drawing mode of the 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, int overlay_id);

Parameters

dwNewBlitMod:
[opt] New drawing mode (values see below). If 0 or unspecified, the object is reset to its definition blit mode. Otherwise bit 8 (user defined color value) is set implicitly.
overlay_id:
[opt] If specified, this will change the blit mode of the graphics overlay instead. The overlay must have been created using SetGraphics first.

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 SetColor()).
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.
GFX_BLIT_Wireframe 16 Draws the mesh as a wireframe. Only works with meshes!
5-7 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.

Example

static g_cursor, g_prev_blit_mode, g_prev_mod;

func Script100()
{
  g_cursor = GetCursor();
  // save previous values
  g_prev_blit_mode = g_cursor->GetObjectBlitMode();
  g_prev_mod = g_cursor->GetClrModulation();
  // color the no-ColorByOwner-parts of the clonk in a glowing green
  g_cursor->SetObjectBlitMode(6);
  g_cursor->SetClrModulation(RGB(100, 255, 110));
  // message
  g_cursor->Message("Look, I can glow!");
}

func Script200()
{
  // reset color
  g_cursor->SetObjectBlitMode(g_prev_blit_mode);
  g_cursor->SetClrModulation(g_prev_mod);
  // Nachricht
  g_cursor->Message("Over already!");
}
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, 2004-03