コード例 #1
0
	void createBunkerAttackThingyHook(const CUnit *unit) {
		//Default StarCraft behavior
		CImage *bunkerImage = unit->connectedUnit->sprite->mainGraphic;

		u8 frameDirection = (unit->currentDirection1 + 16) / 32 % 8;
		const LO_Header *loFile = lo_files->attackOverlays[bunkerImage->id];
		Point8 offset = loFile->getOffset(bunkerImage->frameIndex, frameDirection);

		if (bunkerImage->flags & 0x2) //Is inverted
			offset.x = -offset.x;

		u8 frameAngle;
		u16 spriteId;

		if (unit->id == UnitId::firebat || unit->id == UnitId::gui_montag) {
			frameAngle = ((unit->currentDirection1 + 8) / 16 % 16) * 16;
			spriteId = 378; //Firebat flamethrower graphics
		}
		else {
			frameAngle = frameDirection * 32;
			spriteId = 377; //Bunker attack overlay
		}

		CThingy *bunkerAttackEffect = createThingy(spriteId,
			offset.x + unit->getX(),
			offset.y + unit->getY());
		if (!bunkerAttackEffect) return;

		bunkerAttackEffect->sprite->elevationLevel = unit->sprite->elevationLevel + 1;
		for (CImage *image = bunkerAttackEffect->sprite->images.head;
		image; image = image->link.next) {
			setImageDirection(image, frameAngle);
		}
		setThingyVisibilityFlags(bunkerAttackEffect);
	}
コード例 #2
0
void createBunkerAttackThingyHook(const CUnit *unit) {
  CImage *bunkerImage = unit->connectedUnit->sprite->mainGraphic;

  u8 frameDirection = (unit->currentDirection1 + 16) / 32 % 8;
  const LO_Header *loFile = lo_files->attackOverlays[bunkerImage->id];
  Point8 offset = loFile->getOffset(bunkerImage->frameIndex, frameDirection);
  
  if (bunkerImage->flags & 0x2) //Is inverted
    offset.x = -offset.x;

  u8 frameAngle;
  u16 spriteId;
  bool isBlueFlame = false;

  if (unit->id == UnitId::firebat || unit->id == UnitId::gui_montag) {
    frameAngle = ((unit->currentDirection1 + 8) / 16 % 16) * 16;
    spriteId = 378; //Firebat flamethrower graphics

    //파이어뱃 불꽃 업그레이드 체크
	if (scbw::getUpgradeLevel(unit->playerId, UPGRADE_FIREBAT_BLUE_FLAME)&&unit->id!=UnitId::gui_montag)//파이어뱃일때만 파란불꽃
      isBlueFlame = true;
  }
  //침 뱉는 유닛들
  else if (unit->id == UnitId::hydralisk
           || unit->id == UnitId::hunter_killer
           || unit->id == UnitId::drone)
  {
    frameAngle = ((unit->currentDirection1 + 8) / 16 % 16) * 16;
    spriteId = 332; //히드라, 드론이 침뱉는 이미지
  }
  //총 쏘는 유닛들
  else if (unit->id == UnitId::marine
           || unit->id == UnitId::jim_raynor_marine
           || unit->id == UnitId::civilian
           || unit->id == UnitId::ghost
           || unit->id == UnitId::sarah_kerrigan
           || unit->id == UnitId::alexei_stukov
           || unit->id == UnitId::samir_duran
           || unit->id == UnitId::Hero_InfestedDuran)
  {
    frameAngle = frameDirection * 32;
    spriteId = 377; //Bunker attack overlay
  }
  else
    return;

  CThingy *bunkerAttackEffect = createThingy(spriteId,
                                             offset.x + unit->getX(),
                                             offset.y + unit->getY());
  if (!bunkerAttackEffect) return;

  bunkerAttackEffect->sprite->elevationLevel = unit->sprite->elevationLevel + 1;
  for (CImage *image = bunkerAttackEffect->sprite->imageHead;
       image; image = image->link.next) {
    setImageDirection(image, frameAngle);
  }
  setThingyVisibilityFlags(bunkerAttackEffect);

  //파이어뱃 파란불꽃 설정
  if (isBlueFlame)
    bunkerAttackEffect->sprite->mainGraphic->setRemapping(ColorRemapping::BExpl);
}