void DrawActorHighlight( const ActorPics *pics, const Vec2i pos, const color_t color, const direction_e d) { // Do not highlight dead, dying or transparent characters if (pics->IsDead || pics->IsTransparent) { return; } const Vec2i headPos = GetActorDrawOffset( pos, pics->Head, BODY_PART_HEAD, d); BlitPicHighlight(&gGraphicsDevice, pics->Head, headPos, color); if (pics->Body != NULL) { const Vec2i bodyPos = GetActorDrawOffset( pos, pics->Body, BODY_PART_BODY, d); BlitPicHighlight(&gGraphicsDevice, pics->Body, bodyPos, color); } if (pics->Gun != NULL) { const Vec2i gunPos = GetActorDrawOffset( pos, pics->Gun, BODY_PART_GUN, d); BlitPicHighlight(&gGraphicsDevice, pics->Gun, gunPos, color); } }
void DrawActorHighlight( const ActorPics *pics, const Vec2i pos, const color_t color) { // Do not highlight dead, dying or transparent characters if (pics->IsDead || pics->IsTransparent) { return; } BlitPicHighlight( &gGraphicsDevice, pics->Head, Vec2iAdd(pos, pics->HeadOffset), color); if (pics->Body != NULL) { BlitPicHighlight( &gGraphicsDevice, pics->Body, Vec2iAdd(pos, pics->BodyOffset), color); } if (pics->Legs != NULL) { BlitPicHighlight( &gGraphicsDevice, pics->Legs, Vec2iAdd(pos, pics->LegsOffset), color); } if (pics->Gun != NULL) { BlitPicHighlight( &gGraphicsDevice, pics->Gun, Vec2iAdd(pos, pics->GunOffset), color); } }
static void DrawObjectiveHighlight( TTileItem *ti, Tile *tile, DrawBuffer *b, Vec2i offset) { if (!(ti->flags & TILEITEM_OBJECTIVE)) { return; } int objective = ObjectiveFromTileItem(ti->flags); MissionObjective *mo = CArrayGet(&gMission.missionData->Objectives, objective); if (mo->Flags & OBJECTIVE_HIDDEN) { return; } if (!(mo->Flags & OBJECTIVE_POSKNOWN) && (tile->flags & MAPTILE_OUT_OF_SIGHT)) { return; } Vec2i pos = Vec2iNew( ti->x - b->xTop + offset.x, ti->y - b->yTop + offset.y); struct Objective *o = CArrayGet(&gMission.Objectives, objective); color_t color = o->color; int pulsePeriod = FPS_FRAMELIMIT; int alphaUnscaled = (gMission.time % pulsePeriod) * 255 / (pulsePeriod / 2); if (alphaUnscaled > 255) { alphaUnscaled = 255 * 2 - alphaUnscaled; } color.a = (Uint8)alphaUnscaled; if (ti->getPicFunc != NULL) { Vec2i picOffset; const Pic *pic = ti->getPicFunc(ti->id, &picOffset); BlitPicHighlight( &gGraphicsDevice, pic, Vec2iAdd(pos, picOffset), color); } else if (ti->getActorPicsFunc != NULL) { ActorPics pics = ti->getActorPicsFunc(ti->id); // Do not highlight dead, dying or transparent characters if (!pics.IsDead && !pics.IsTransparent) { for (int i = 0; i < 3; i++) { if (PicIsNotNone(&pics.Pics[i])) { BlitPicHighlight( &gGraphicsDevice, &pics.Pics[i], pos, color); } } } } }
static void DrawObjectiveHighlight( TTileItem *ti, Tile *tile, DrawBuffer *b, Vec2i offset) { color_t color; if (ti->flags & TILEITEM_OBJECTIVE) { // Objective const int objective = ObjectiveFromTileItem(ti->flags); const Objective *o = CArrayGet(&gMission.missionData->Objectives, objective); if (o->Flags & OBJECTIVE_HIDDEN) { return; } if (!(o->Flags & OBJECTIVE_POSKNOWN) && (tile->flags & MAPTILE_OUT_OF_SIGHT)) { return; } color = o->color; } else if (ti->kind == KIND_PICKUP) { // Gun pickup const Pickup *p = CArrayGet(&gPickups, ti->id); if (!PickupIsManual(p)) { return; } color = colorDarker; } else { return; } const Vec2i pos = Vec2iNew( ti->x - b->xTop + offset.x, ti->y - b->yTop + offset.y); const int pulsePeriod = ConfigGetInt(&gConfig, "Game.FPS"); int alphaUnscaled = (gMission.time % pulsePeriod) * 255 / (pulsePeriod / 2); if (alphaUnscaled > 255) { alphaUnscaled = 255 * 2 - alphaUnscaled; } color.a = (Uint8)alphaUnscaled; if (ti->getPicFunc != NULL) { Vec2i picOffset; const Pic *pic = ti->getPicFunc(ti->id, &picOffset); BlitPicHighlight( &gGraphicsDevice, pic, Vec2iAdd(pos, picOffset), color); } else if (ti->kind == KIND_CHARACTER) { TActor *a = CArrayGet(&gActors, ti->id); ActorPics pics = GetCharacterPicsFromActor(a); DrawActorHighlight(&pics, pos, color); } }