diff --git a/src/include/unittype.h b/src/include/unittype.h index 4a7999c93..33ec6f716 100644 --- a/src/include/unittype.h +++ b/src/include/unittype.h @@ -706,6 +706,7 @@ class CUnitType int Upkeep; /// Gold upkeep (for grand strategy mode) int ItemClass; /// Item class (if the unit type is an item) std::vector WeaponClasses; /// Weapon classes that the unit type can use (if the unit type uses a weapon) + bool InvertedSoutheastArms; /// Whether the arms are inverted for the southeast/southwest graphics //Wyrmgus end PixelPos MissileOffsets[UnitSides][MaxAttackPos]; /// Attack offsets for missiles diff --git a/src/unit/script_unittype.cpp b/src/unit/script_unittype.cpp index 9e4199466..faa6666c3 100644 --- a/src/unit/script_unittype.cpp +++ b/src/unit/script_unittype.cpp @@ -652,6 +652,7 @@ static int CclDefineUnitType(lua_State *l) type->Sound = parent_type->Sound; type->NumDirections = parent_type->NumDirections; type->NeutralMinimapColorRGB = parent_type->NeutralMinimapColorRGB; + type->InvertedSoutheastArms = parent_type->InvertedSoutheastArms; if (parent_type->CanCastSpell) { type->CanCastSpell = new char[SpellTypeTable.size()]; memset(type->CanCastSpell, 0, SpellTypeTable.size() * sizeof(char)); @@ -1867,6 +1868,8 @@ static int CclDefineUnitType(lua_State *l) LuaError(l, "incorrect weapon class"); } } + } else if (!strcmp(value, "InvertedSoutheastArms")) { + type->InvertedSoutheastArms = LuaToBoolean(l, -1); //Wyrmgus end } else { int index = UnitTypeVar.VariableNameLookup[value]; diff --git a/src/unit/unit_draw.cpp b/src/unit/unit_draw.cpp index f03e51649..b210633e7 100644 --- a/src/unit/unit_draw.cpp +++ b/src/unit/unit_draw.cpp @@ -1192,16 +1192,29 @@ void CUnit::Draw(const CViewport &vp) const DrawPlayerColorOverlay(*type, this->GetLayerSprite(BackpackImageLayer), player, this->GetLayerFrame(BackpackImageLayer, frame), screenPos + this->GetLayerOffset(BackpackImageLayer, frame)); } - //draw the left arm before the body if not facing south (or the still frame, since that also faces south) - if ((this->Direction != LookingS || this->CurrentAction() == UnitActionDie) && frame != type->StillFrame) { + //draw the left arm before the body if not facing south (or the still frame, since that also faces south); if the position of the arms in the southeast frame is inverted, don't draw the left arm yet either + if ( + (this->Direction != LookingS || this->CurrentAction() == UnitActionDie) + && frame != type->StillFrame + && !( + type->InvertedSoutheastArms + && (this->Direction == LookingSE || this->Direction == LookingSW || (this->Direction == LookingS && this->CurrentAction() == UnitActionDie)) + ) + ) { //draw the shield before the left arm if not facing south DrawPlayerColorOverlay(*type, this->GetLayerSprite(ShieldImageLayer), player, this->GetLayerFrame(ShieldImageLayer, frame), screenPos + this->GetLayerOffset(ShieldImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(LeftArmImageLayer), player, this->GetLayerFrame(LeftArmImageLayer, frame), screenPos + this->GetLayerOffset(LeftArmImageLayer, frame)); } - //draw the right arm before the body if facing north - if (this->Direction == LookingN && this->CurrentAction() != UnitActionDie) { + //draw the right arm before the body if facing north, or if facing southeast/southwest and the arms are inverted for that direction + if ( + (this->Direction == LookingN && this->CurrentAction() != UnitActionDie) + || ( + type->InvertedSoutheastArms + && (this->Direction == LookingSE || this->Direction == LookingSW || (this->Direction == LookingS && this->CurrentAction() == UnitActionDie)) + ) + ) { DrawPlayerColorOverlay(*type, this->GetLayerSprite(WeaponImageLayer), player, this->GetLayerFrame(WeaponImageLayer, frame), screenPos + this->GetLayerOffset(WeaponImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(RightArmImageLayer), player, this->GetLayerFrame(RightArmImageLayer, frame), screenPos + this->GetLayerOffset(RightArmImageLayer, frame)); } @@ -1286,14 +1299,27 @@ void CUnit::Draw(const CViewport &vp) const DrawPlayerColorOverlay(*type, this->GetLayerSprite(BootsImageLayer), player, this->GetLayerFrame(BootsImageLayer, frame), screenPos + this->GetLayerOffset(BootsImageLayer, frame)); //draw the left arm just after the body if facing south - if ((this->Direction == LookingS && this->CurrentAction() != UnitActionDie) || frame == type->StillFrame) { + if ( + (this->Direction == LookingS && this->CurrentAction() != UnitActionDie) + || frame == type->StillFrame + || ( + type->InvertedSoutheastArms + && (this->Direction == LookingSE || this->Direction == LookingSW || (this->Direction == LookingS && this->CurrentAction() == UnitActionDie)) + ) + ) { DrawPlayerColorOverlay(*type, this->GetLayerSprite(LeftArmImageLayer), player, this->GetLayerFrame(LeftArmImageLayer, frame), screenPos + this->GetLayerOffset(LeftArmImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(ClothingLeftArmImageLayer), player, this->GetLayerFrame(ClothingLeftArmImageLayer, frame), screenPos + this->GetLayerOffset(ClothingLeftArmImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(ShieldImageLayer), player, this->GetLayerFrame(ShieldImageLayer, frame), screenPos + this->GetLayerOffset(ShieldImageLayer, frame)); } //draw the right arm just after the body if not facing north - if (this->Direction != LookingN || this->CurrentAction() == UnitActionDie) { + if ( + (this->Direction != LookingN || this->CurrentAction() == UnitActionDie) + && !( + type->InvertedSoutheastArms + && (this->Direction == LookingSE || this->Direction == LookingSW || (this->Direction == LookingS && this->CurrentAction() == UnitActionDie)) + ) + ) { DrawPlayerColorOverlay(*type, this->GetLayerSprite(WeaponImageLayer), player, this->GetLayerFrame(WeaponImageLayer, frame), screenPos + this->GetLayerOffset(WeaponImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(RightArmImageLayer), player, this->GetLayerFrame(RightArmImageLayer, frame), screenPos + this->GetLayerOffset(RightArmImageLayer, frame)); DrawPlayerColorOverlay(*type, this->GetLayerSprite(ClothingRightArmImageLayer), player, this->GetLayerFrame(ClothingRightArmImageLayer, frame), screenPos + this->GetLayerOffset(ClothingRightArmImageLayer, frame)); diff --git a/src/unit/unittype.cpp b/src/unit/unittype.cpp index 76ad4b669..8d6577b1a 100644 --- a/src/unit/unittype.cpp +++ b/src/unit/unittype.cpp @@ -563,7 +563,7 @@ CUnitType::CUnitType() : Slot(0), Width(0), Height(0), OffsetX(0), OffsetY(0), DrawLevel(0), ShadowWidth(0), ShadowHeight(0), ShadowOffsetX(0), ShadowOffsetY(0), //Wyrmgus start - TechnologyPointCost(0), Upkeep(0), TrainQuantity(0), ItemClass(-1), + TechnologyPointCost(0), Upkeep(0), TrainQuantity(0), ItemClass(-1), InvertedSoutheastArms(false), //Wyrmgus end Animations(NULL), StillFrame(0), DeathExplosion(NULL), OnHit(NULL), OnEachCycle(NULL), OnEachSecond(NULL), OnInit(NULL),