MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / GUI_Handle_Button_TroopName

Method GUI_Handle_Button_TroopName

Source/GUI_Element.cpp:779–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777}
778
779void cFodder::GUI_Handle_Button_TroopName() {
780
781 if (Mouse_Button_Left_Toggled() < 0) {
782 if (Mouse_Button_Right_Toggled() < 0)
783 return;
784 }
785
786 if (mSquad_Selected < 0)
787 return;
788
789 int16 Data0 = mMouseY;
790 Data0 -= mGUI_Mouse_Modifier_Y;
791 Data0 -= mGUI_TroopName_DrawOffset;
792 Data0 -= 0x22;
793 Data0 /= 0x0C;
794
795 if (Data0 >= mSquads_TroopCount[mSquad_Selected])
796 return;
797
798 word_3A3BF = Data0;
799
800 sMission_Troop* Troop = mGame_Data.mSoldiers_Allocated;
801 int16 Data8 = word_3A3BF;
802
803 for (int16 Data1C = 7; Data1C >= 0; --Data1C, ++Troop) {
804
805 sSprite* Data34 = Troop->mSprite;
806
807 if (Data34 == INVALID_SPRITE_PTR || Data34 == 0)
808 continue;
809
810 if (mSquad_Selected != Data34->field_32)
811 continue;
812
813 --Data8;
814 if (Data8 < 0)
815 break;
816 }
817
818 Troop->mSelected ^= 1;
819
820 const sRecruit* Data28 = &mRecruits[Troop->mRecruitID];
821 Data0 = Troop->mSelected & 1;
822 Data8 = word_3A3BF;
823 Data8 *= 0x0C;
824
825 Data8 += mGUI_TroopName_DrawOffset;
826 Data8 += 0x24;
827
828 int16 DataC = Data8;
829
830 GUI_Sidebar_TroopList_Name_Draw(Data0, Data8, DataC, Data28->mName);
831 sub_3049B();
832 sub_3037A();
833}
834
835
836int16 cFodder::sub_2FF41() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected