Allow FindState from ui context

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Allow FindState from ui context

Re: Allow FindState from ui context

by Graf Zahl » Sun Jun 11, 2017 11:32 am

It just got overlooked. In general, this should be C/S-safe and accessing too much of the play state is not good - but since the cast call already needs this access anyway an exception can be made here.

Allow FindState from ui context

by AFADoomer » Sun Jun 11, 2017 11:17 am

I'm trying to tweak the PlayerMenu so that I can add a "Portrait" state to my player class and use that for the player animation instead of See or Spawn (because the class uses "####" frames, and you end up with random sprites as your animation).

I'd like to be able to do something like this in the code:

Code: Select all

    void ExtendedUpdatePlayer(int classnum)
    {
        mPlayerClass = PlayerClasses[classnum];
        mPlayerState = GetDefaultByType (mPlayerClass.Type).FindState("Portrait"); // <---  Obviously doesn't work...
        if (mPlayerState == NULL) { mPlayerState = GetDefaultByType (mPlayerClass.Type).SeeState; }
        if (mPlayerState == NULL) { mPlayerState = GetDefaultByType (mPlayerClass.Type).SpawnState; }
        mPlayerTics = mPlayerState != NULL ? mPlayerState.Tics : -1;
    }
Is there a reason why FindState (as well as some of the other non-modifying functions) can't be made accessible from ui?

Top