Announcement

Collapse
No announcement yet.

GUI Modification

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GUI Modification

    I am moving a discussion out of "The best of all possible worlds" to this thread to keep the discussions separate. From the 6th page of that thread, I said:

    I recently undertook two little project to fix some annoyances.

    1. I moved the Pollution Total number from the Status Tab to the Specialists Tab in the City Management screen (I did this so I could see the effect on total pollution when I assign new workers to different tasks). The up side is that it worked, the downside is that this required Hex editing.

    Original CTP2 screenshot here: http://apolyton.net/dir/index.php?s...ts=3759&cat=197

    Mission accomplished!

    2. An even larger problem was that I wanted to add a shortcut button to the City Management screen in the National Manager screen, instead of just the Build Manager. As it is now if you are looking at the NatMan and want to adjust workers, you have to go to Build manager, then city manager, then the Specialists tab, and check that status tab to see the effect on pollution.

    screenshot here: http://apolyton.net/dir/index.php?s...ts=3759&cat=197

    I have added the button to the National Manager screen, no problem, but getting it to function is another matter. This requires Hex editing too and it is very very difficult, I haven't succeeded in this yet (I stopped working on it 2 weeks ago, but hope to resume at some point).

    The problem it that there are only two function calls to display the City Mananger (One in the shortcut bar at the bottom and the other in the Build Manager), if you move it, you lose it in one place (I'm choosing to lose the one in build manager). However, the placement of the function calls are determined by the modules in the original compile of the game (whatever.cpp) The City Manager and the Build Manager seem to come from different files (If I remember correctly).

    Mission in doubt at the moment.

    Also, when Hex editing the total ctp2.exe file cannot exceed by a single bit a predetermined number, which I can post later tonight.

  • #2
    Pedrunn said:

    Originally posted by ahenobarb
    The up side is that it worked, the downside is that this required Hex editing.

    1)Could you be more specific. What worked and what needed Hex editing?

    Originally posted by ahenobarb
    I have added the button to the National Manager screen, no problem, but getting it to function is another matter.

    2) Luckly (really luckly), I think we can do it through slic. Attach the changed ldl file screen and tell me in wich line the button is. We can give this a shot.

    Comment


    • #3
      I replied

      I'll try to clarify:

      1) I successfully moved the Pollution Total number from the Status screen to the Specialists screen. This required 2 steps.

      a) editing the .ldl to add a pollution row to the Specialists screen, which requried moving the other rows closer together -- easy enough.

      b) Hex editing the ctp2.exe in order to have the actual total number (the variable) displayed in the Specialist Tab instead of the Status Tab.

      I can share a screenshot when I get home and I'll give you the name of the variable that stores the total.

      task one was therefore a success.

      2) Out of sheer frustration, I have set aside SLIC for the time being (although I found a really good SLIC tutorial that Locutus put together that I want to spend some time with), so I can't speak to its full capabilites although I have a general knowledge of what it can do. But in looking at .exe file, I'm not optimistic that SLIC can add a functional button to another CTP2 screen. Theoretically copying CTP2 values (Total Gold, Total Pollution, etc.) to new variables for display in a custom created CTP2 menu may be possible. But, adding values to existing CTP2 screens requires HEX editing.

      Regarding the total size of the CTP2.exe file, I can send the total bytes later tonight. However, if you right click the .exe and check properties it will tell you the value. If it is more or less than this, the file won't function (you can tell you've broken it when the CTP2 icon disappears and is replaced by a generic MS icon).

      I had hoped to share this with everyone once I had the "City Manager" button working in the NatMan screen. But, no luck --so far.

      Just a final note in case there is/was confusion, the screenshots I linked to before were provided so that it was possible to see the screens I was discussing without having to visualize them. They are not the ones I have modified.

      Comment


      • #4
        Martin Gühmann Says:

        ahenobarb I think you need to some nice hack tools to fix the ctp2.exe afterwards, unfortunatly adding stuff is very difficuilt if you don't have the source code, but such minor stuff is possible, maybe it is just one typo that cause the Sea City Sprite Bug for instance. To breack the sprite limits should be possible in the same way.

        And by the way here is a list of CTP2 *.cpp files.



        Code:
        C:\ctp2- src\ctp2_project\ctp2_code\gfx\spritesys\directore
        vent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\ArmyEvent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\CityEvent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\combatevent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\Events.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\gs\gameobj\EventTracker
        .cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\FeatTracker.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\gs\gameobj\GaiaControll
        er.cpp
        GameObj_Insert.cpp
        GameObj.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\gs\gameobj\improvemente
        vent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\PlayerEvent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\tradeevent
        C:\ctp2-src\ctp2_project\ctp2_code\gs\gameobj\UnitEvent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\gs\utility\TurnCntEvent
        .cpp
        C:\ctp2-src\ctp2_project\ctp2_code\gs\world\worldevent.cpp
        Token.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\net\general\networkeven
        t.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ui\aui_ctp2\SelItemEven
        t
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\MainContro
        lPanel.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\interfacee
        vent
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\armymanage
        rwindow.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\diplomacyw
        indow.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\ui\interface\dipwizard
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\trademanag
        er.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ui\interface\unitmanage
        r.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\sound\soundevent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\DStateEven
        t.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\Motivation
        Event.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\NProposalE
        vent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\ProposalRe
        sponseEvent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\ReactEvent
        .cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\RegardEven
        t.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\RejectResp
        onseEvent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\ResponseEv
        ent.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\SStateEven
        t.cpp
        C:\ctp2- src\ctp2_project\ctp2_code\ai\diplomacy\ThreatResp
        onseEvent.cpp
        C:\ctp2-src\ctp2_project\ctp2_code\ai\CtpAi.cpp


        Source ctp2.exe. That is a lot of stuff that you can find in the ctp2.exe in ASCII text.

        -Martin

        Comment


        • #5
          Me again:

          Here is the screenshot of the Pollution field. The .ldl file to change is citywindow.ldl

          The variable to search for in your HEx editor is PollutionTotalLabel
          When you find it, you need to change it

          from:

          Tabs.Statistics.TabPanel.PollutionTotalLabel

          To:

          Tabs.Specialists.TabPanel.PollutionTotalLabel

          You will notice the second is 1 byte longer, so I went out into the empty space right after the label and delete the second blank (I think, it's been a while). It works with no problems.

          It should be noted however that both Tabs.Statistics (The Status Tab) and Tabs.Specialists fall under Unitmanager.cpp in the .exe file. This is important for the second change I want to make (I think).

          Comment


          • #6
            The second change I want to make is trickier. As you can see I added the button no problem. This is done in Citystatus.ldl under CityStatusWin.

            However, the function of the button is contained in two different hardcoded variables:

            1) GotoCityButton. This is the function call in the Build Manager screen that tells the program to bring up the City Manager screen. The text formatting associated with this function call, i.e. the button, is in citystatus.ldl and in the CTPII.exe file this function call is under the dipwizard.cpp file.

            2) CityManagementButton. This is the function call in the Control Panel that brings up the City Manager screen from there. The text formatting associated with this function call, i.e. the button, is in the controlpanel.ldl file and in the CTPII.exe this is function call under the maincontrolpanel.cpp file.

            In #1, I was just moving a variable from one place in unitmanager.cpp to a different tab. CityStatusWin in the CTPII.exe however is found under the unitmanager.cpp file. So it looks like in Step #2 I am trying to move a variable from one .cpp file to another, which I don't think is possible. I tried several things with no luck. I still plan to give it another look at some point.

            If anyone is interested, I'll share the modified .ldl files.

            Comment


            • #7
              SMIFFGIG, replied:

              AN IDEA!! for culture!!!!

              Wow ahenobarb its cool how your adding these buttons to the GUI

              I was wondering if it were possible to add a button (which popped up with a message box that could be created through SLIC maybe?) or a tab in the city screen which displayed culture.

              It would be very good if this could be possible

              Comment


              • #8
                Ahenobarb replies

                For an existing menu, visually this would be very easy. The .ldl files allow you to pretty much change/add/delete/move anything you want about the GUI visually.

                Functionally is another matter. You can add buttons and so forth to the screens, they will click, but nothing will actually happen (no culture screen will pop-up) unless it is linked to a specific function in the CTPII.exe file.

                I am optimistic that with SLIC you can create a custom or user created menu, and tell that menu what to do when certain buttons are clicked. It seems, that custom menus are the way to go for a culture screen. The .SLC code would need to tell it to pop-up every 10 turns or so so you could see it.

                I will continue to play around with the menus to test the limits of customization and hopefully there will be some breakthrough. I should learn SLC first though.

                Comment


                • #9
                  Pedrunn:

                  No! There is a way to make a slic code trigger when pressing UI componesnts and the same way i was going to use to open the city manager but unfortunetly there is no OpenCityManage() like function. So it is possible to do what you intend, Big Mc.
                  Here are some examples of slic codes triggered by slic:
                  NewDiplomod: Triggered when hitting the treaties tab in the make proposal screen


                  Code:
                  trigger 'NewTreatyDataFollowingProp' on "DipWizard.Stage2.Tabs.Treaty.TabPanel" when (1) {//secondary proposal
                  int_t second_type; // following proposal
                      message(g.player,'TreatyLength');
                  }
                  Locutus PBEM fix:Triggered when hitting the wheel diplomatic button.

                  Code:
                  Trigger 'PBEM_test' on "ControlPanelWindow.ControlPanel.ShortcutPad.DiplomacyButton" when (1) {
                  	PBEM_opponent = 2;
                  	player[3] = PBEM_opponent;
                  	Message(g.player, 'PBEM_Start_M');
                  }
                  Mine PBEM fix: Triggered when hitting the wheel diplomatic button. The accept and reject proposal button

                  Code:
                  Trigger 'PBEM_CheckMessages' on "ControlPanelWindow.ControlPanel.ShortcutPad.DiplomacyButton" when (1) {
                  int_t sucess;
                  int_t i;
                  int_t tmpPlayer;
                  	tmpPlayer = g.player;
                  	Sucess = 1;
                  	i = 0;
                  	while(i < PBEM_HasBeenSent.#) {
                  		if(PBEM_HasBeenSent[i] == 0) {
                  			if(PBEM_Response[i] == 0 
                  			&& tmpPlayer == PBEM_receiver[i]) {
                  				PBEM_TMP_Response = 0;
                  				PBEM_CanSendProposal = 1;
                  				PBEM_PreventLoop = 1;
                  				ConsiderNewProposal(PBEM_Sender[i], PBEM_receiver[i], 2000, PBEM_Proposal[i],0,ID_NONE,ID_NONE,ID_NONE); 
                  				Event: NewProposal(PBEM_Sender[i], PBEM_receiver[i]);
                  				PBEM_HasBeenSent[i] = 1;
                  				return STOP;
                  			}
                  		}
                  		i = i + 1;
                  	}
                  }
                  
                  trigger 'PBEM_ProposalRejected' on "DipWizard.ViewButtons.RejectButton" when (1) {
                  int_t ProposalType;
                  int_t tmpPlayer;
                  	tmpPlayer = g.player;
                  	ProposalType = GetLastNewProposalType(PBEM_TMP_Sender, tmpPlayer, 0);	
                  	toreDiplomacyEvent(PBEM_TMP_Sender, tmpPlayer, PBEM_TMP_Proposal, 1);
                  	message(PBEM_TMP_Sender, 'PBEM_ProposalRejectedMSG');
                  }
                  
                  trigger 'PBEM_ProposalAccepted' on "DipWizard.ViewButtons.AcceptButton" when (1) {
                  int_t ProposalType;
                  int_t tmpPlayer;
                  	tmpPlayer = g.player;
                  	ProposalType = GetLastNewProposalType(PBEM_TMP_Sender, tmpPlayer, 0);	
                  	StoreDiplomacyEvent(PBEM_TMP_Sender, tmpPlayer, PBEM_TMP_Proposal, 2);
                  	message(PBEM_TMP_Sender, 'PBEM_ProposalRejectedMSG');
                  }
                  All this codes tested and working (at least the trigger).
                  So it is possible to trigger codes and messages when pressing buttons and others UI componests.

                  Comment


                  • #10
                    Me again: [Last one, Phew!]

                    Hey great news! It sounds like all of this can come together afterall. Again, I need to improve my knowledge of what SLIC can do, it seems surprisingly versitile, but occasionally it meets up with limitations hard coded into the original program.

                    Comment


                    • #11
                      Re: Pedrunn:

                      Originally posted by Pedrunn

                      Code:
                      Trigger 'PBEM_test' on "ControlPanelWindow.ControlPanel.ShortcutPad.DiplomacyButton" when (1) {
                      	PBEM_opponent = 2;
                      	player[3] = PBEM_opponent;
                      	Message(g.player, 'PBEM_Start_M');
                      }
                      All this codes tested and working (at least the trigger).
                      So it is possible to trigger codes and messages when pressing buttons and others UI componests.
                      I downloaded the PBEM file and found:

                      Code:
                      // Search in arrays proposal
                      // Trigger 'PBEM_test' on "ControlPanelWindow.ControlPanel.ShortcutPad.DiplomacyButton" when (1) {
                      // This trigger is probably better
                      With the "//" in front of the lines, it looks like this was disabled. Also, if I am reading the code right, it seems to say that when you click the button execute the function "ControlPanelWindow.ControlPanel.ShortcutPad.Diplom acyButton" -- which is the function in the CTPII.exe file to bring up the diplomacy screen -- execute 'PBEM_test' and bring up the diplomacy screen.

                      I haven't had time to try the file yet, but in this instance it still seems to me that to bring up a screen, meaning to have a functioning button, it still must be keyed to a valid function contained within the CTPII.exe file -- in this case "ControlPanelWindow.ControlPanel.ShortcutPad.Diplom acyButton".

                      So if you add a new button, it still has to be keyed to a valid function in CTPII.exe

                      What I would like to find out, and perhaps you can help clarify, is whether or not it would be possible to add a new button and have a SLIC code that says:when you hit this new button, execute this valid function [ControlPanelWindow.ControlPanel.ShortcutPad.Diplom acyButton" for instace] as if the new button were actually the Diplomacy button.

                      Maybe that's what the code you are displaying says? Due to UUNet's problems yesterday, I couldn't test these code items. Maybe you can clarify for me?

                      Comment


                      • #12
                        This isnt going to help you in the slighteset, but the links in your first post both lead to the general screenshots directory and not yours
                        Oxygen should be considered a drug
                        Tiberian Sun Retro
                        My Mod for Tiberian Sun Webmaster of
                        http://www.tiberiumsun.com

                        Comment


                        • #13
                          Originally posted by SMIFFGIG
                          This isnt going to help you in the slighteset
                          I admire your honesty

                          Actually I just checked and it looks like they are the screenshots from my GUI changes. You can see the Pollution total on the first and the City Manager button on the bottom of the other.

                          Does anyone have any guidance on getting the City Manager button to actually function? If someone already knows how to do this, I'd hate to spend several hours of trial and error to get it to work when the answer is already known.

                          Comment


                          • #14
                            Code:
                            Trigger 'OpenDiplomacyScreen' when (g.player == 1 && clicked.unit && unit.owner != 1) {
                            	OpenDiplomacy();
                            }
                            This code is taken from the Apolyton CTP I Developer's site. Is there an equivalent database in CTP II to the "clicked" database referenced above? ArmyClicked does not seem to work in this context.

                            Also, following the examples above, I am trying to get the Buildqueue button in the national manager button to open the City Manager instead of the BuildManager. The code I have is below

                            Code:
                            Trigger 'NewCityButton' on "CityStatusWin.BuildQueueButton" when (1) {
                                OpenCity();
                            }
                            Any thoughts on why this isn't working?

                            Comment


                            • #15
                              Trigger 'NewCityButton' on "CityStatusWin.BuildQueueButton" when (1) {
                              OpenCity();
                              }
                              You mean this isnt opening the city status as it should?
                              Thats strange.
                              Are you sure the path "CityStatusWin.BuildQueueButton" is valid?
                              In wich file it is? I want to see it!
                              "Kill a man and you are a murder.
                              Kill thousands and you are a conquer.
                              Kill all and you are a God!"
                              -Jean Rostand

                              Comment

                              Working...
                              X