Ticket #9237: save_actorstate.patch

File save_actorstate.patch, 2.8 KB (added by SF/tobigun, 14 years ago)

save C64 actor state

  • actor.cpp

     
    27172717                MKARRAY(Actor, _cost.heJumpOffsetTable[0], sleUint16, 16, VER(65)),
    27182718                MKARRAY(Actor, _cost.heJumpCountTable[0], sleUint16, 16, VER(65)),
    27192719                MKARRAY(Actor, _cost.heCondMaskTable[0], sleUint32, 16, VER(65)),
     2720
     2721                MKLINE(Actor, _miscflags, sleByte, VER(84)),
     2722                MKLINE(Actor, _speaking, sleByte, VER(84)),
     2723                MKLINE(Actor, _speakingPrev, sleByte, VER(84)),
     2724                MKLINE(Actor, _costCommand, sleByte, VER(84)),
     2725                MKLINE(Actor, _costFrame, sleByte, VER(84)),
     2726
    27202727                MKEND()
    27212728        };
    27222729
  • actor.h

     
    141141        uint32 _hePaletteNum;
    142142        uint32 _heXmapNum;
    143143
     144public:
     145        /* v0 specific */
     146        byte _miscflags; // 0x1: strong, 0x8: Ed's enemy, 0x40: stop moving, 0x80: hide(dead/radiation suit)
     147        byte _speaking, _speakingPrev;
     148        byte _costCommand, _costFrame;
     149
    144150protected:
    145151        struct ActorWalkData {
    146152                Common::Point dest;           // Final destination point
     
    381387
    382388class ActorC64 : public Actor_v2 {
    383389public:
    384         // FIXME: These vars are never saved, which might lead to broken save states.
    385         byte _miscflags;
    386         byte _speaking, _speakingPrev;
    387         byte _costCommand, _costFrame;
    388 
    389 public:
    390         ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
    391                  _speaking = _speakingPrev = _costCommand = _costFrame = 0;
    392         }
     390        ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {}
    393391        virtual void initActor(int mode) {
    394392                Actor_v2::initActor(mode);
     393                _speaking = 0;
     394                _speakingPrev = 0;
     395                _costCommand = 0;
     396                _costFrame = 0;
    395397                if (mode == -1) {
    396398                        _miscflags = 0;
    397399                }
  • saveload.h

     
    5050 * only saves/loads those which are valid for the version of the savegame
    5151 * which is being loaded/saved currently.
    5252 */
    53 #define CURRENT_VER 83
     53#define CURRENT_VER 84
    5454
    5555/**
    5656 * An auxillary macro, used to specify savegame versions. We use this instead
  • verbs.cpp

     
    836836               
    837837                // Ignore verbs?
    838838                Actor *a = derefActor(VAR(VAR_EGO), "verbObtain");
    839                 if (((ActorC64 *)a)->_miscflags & 0x40) {
     839                if (a->_miscflags & 0x40) {
    840840                        resetSentence(false);
    841841                        return false;
    842842                }
     
    928928                if (verbMoveToActor(_activeActor)) {
    929929                        // Ignore verbs?
    930930                        Actor *a = derefActor(VAR(VAR_EGO), "verbExec");
    931                         if (((ActorC64 *)a)->_miscflags & 0x40) {
     931                        if (a->_miscflags & 0x40) {
    932932                                resetSentence(false);
    933933                                return false;
    934934                        }