00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pent_include.h"
00020 #include "AnimAction.h"
00021 #include "Actor.h"
00022
00023 void AnimAction::getAnimRange(unsigned int lastanim, int lastdir,
00024 bool firststep, int dir,
00025 unsigned int& startframe, unsigned int& endframe) const
00026 {
00027 startframe = 0;
00028 endframe = size;
00029
00030 if (flags & AAF_TWOSTEP) {
00031
00032 if (firststep) {
00033 if (flags & (AAF_LOOPING | AAF_LOOPING2)) {
00034
00035
00036 startframe = size - 1;
00037 } else {
00038 startframe = 0;
00039 }
00040 endframe = size/2;
00041 } else {
00042
00043 startframe = size / 2;
00044 if (flags & (AAF_LOOPING | AAF_LOOPING2)) {
00045 endframe = size - 1;
00046 }
00047 }
00048 } else {
00049 if (lastanim == action && lastdir == dir && size > 1)
00050 {
00051
00052 startframe = 1;
00053 }
00054 }
00055 }
00056
00057 void AnimAction::getAnimRange(Actor* actor, int dir,
00058 unsigned int& startframe,
00059 unsigned int& endframe) const
00060 {
00061 getAnimRange(actor->getLastAnim(), actor->getDir(),
00062 (actor->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0,
00063 dir, startframe, endframe);
00064 }