mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
hero animation speed now independent
This commit is contained in:
@@ -1072,7 +1072,9 @@ void CTerrainRect::show()
|
||||
{
|
||||
SDL_Surface * teren = CGI->mh->terrainRect
|
||||
(LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
|
||||
tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim, LOCPLINT->cb->getVisibilityMap());
|
||||
tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim,
|
||||
LOCPLINT->cb->getVisibilityMap(), true, LOCPLINT->adventureInt->heroAnim
|
||||
);
|
||||
SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),ekran,&genRect(547,594,7,6));
|
||||
SDL_FreeSurface(teren);
|
||||
if (currentPath && LOCPLINT->adventureInt->position.z==currentPath->startPos().z) //drawing path
|
||||
@@ -1363,6 +1365,8 @@ endTurn(CGI->preth->advEndTurn.first,CGI->preth->advEndTurn.second,
|
||||
updateScreen = false;
|
||||
anim=0;
|
||||
animValHitCount=0; //animation frame
|
||||
heroAnim=0;
|
||||
heroAnimValHitCount=0; // hero animation frame
|
||||
|
||||
heroList.init();
|
||||
heroList.genList();
|
||||
|
@@ -222,6 +222,7 @@ public:
|
||||
bool scrollingDown ;
|
||||
bool updateScreen, updateMinimap ;
|
||||
unsigned char anim, animValHitCount; //animation frame
|
||||
unsigned char heroAnim, heroAnimValHitCount; //animation frame
|
||||
|
||||
CMinimap minimap;
|
||||
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
friend void handleCPPObjS(std::map<int,CCPPObjectScript*> * mapa, CCPPObjectScript * script);
|
||||
//CCallback * cb; //for communication between PlayerInterface/AI and GameState
|
||||
|
||||
friend SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, unsigned char anim, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap); //todo: wywalic koniecznie, tylko do flag obecnie!!!!
|
||||
friend SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, unsigned char anim, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap, bool otherHeroAnim, unsigned char heroAnim); //todo: wywalic koniecznie, tylko do flag obecnie!!!!
|
||||
};
|
||||
|
||||
#endif //CGAMESTATE_H
|
||||
|
@@ -443,6 +443,7 @@ void CPlayerInterface::yourTurn()
|
||||
makingTurn = true;
|
||||
CGI->localPlayer = serialID;
|
||||
unsigned char & animVal = LOCPLINT->adventureInt->anim; //for animations handling
|
||||
unsigned char & heroAnimVal = LOCPLINT->adventureInt->heroAnim;
|
||||
adventureInt->infoBar.newDay(cb->getDate(1));
|
||||
adventureInt->show();
|
||||
//show rest of things
|
||||
@@ -479,6 +480,7 @@ void CPlayerInterface::yourTurn()
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
|
||||
}
|
||||
++heroAnimVal;
|
||||
if(LOCPLINT->adventureInt->scrollingLeft)
|
||||
{
|
||||
if(LOCPLINT->adventureInt->position.x>-Woff)
|
||||
@@ -1102,6 +1104,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
++LOCPLINT->adventureInt->anim;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
}
|
||||
++LOCPLINT->adventureInt->heroAnim;
|
||||
|
||||
SDL_framerateDelay(mainFPSmng); //for animation purposes
|
||||
} //for(int i=1; i<32; i+=4)
|
||||
|
@@ -611,8 +611,10 @@ void CMapHandler::init()
|
||||
calculateBlockedPos();
|
||||
}
|
||||
|
||||
SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, unsigned char anim, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap)
|
||||
SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, unsigned char anim, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap, bool otherHeroAnim, unsigned char heroAnim)
|
||||
{
|
||||
if(!otherHeroAnim)
|
||||
heroAnim = anim; //the same, as it should be
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
int rmask = 0xff000000;
|
||||
int gmask = 0x00ff0000;
|
||||
@@ -703,14 +705,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==10)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
@@ -723,14 +725,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==5)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
@@ -743,14 +745,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==6)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
@@ -763,14 +765,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==7)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
@@ -783,14 +785,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==8)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 6: //ok
|
||||
@@ -803,14 +805,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==9)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
@@ -823,14 +825,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==12)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
@@ -843,14 +845,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
{
|
||||
if(iv[gg].groupNumber==11)
|
||||
{
|
||||
tb = iv[gg+anim%imgVal].bitmap;
|
||||
tb = iv[gg+heroAnim%imgVal].bitmap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(tb,&pp,su,&sr);
|
||||
pp.y+=imgVal*2-32;
|
||||
sr.y-=16;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+anim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[gg+heroAnim%imgVal+35].bitmap, &pp, su, &sr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -881,7 +883,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[13*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[13*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -906,7 +908,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -931,7 +933,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -956,7 +958,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[2*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[2*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -981,7 +983,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[3*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[3*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -1006,7 +1008,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[4*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[4*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -1031,7 +1033,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[15*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[15*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
@@ -1056,7 +1058,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
||||
SDL_Rect bufr = sr;
|
||||
bufr.x-=2*32;
|
||||
bufr.y-=1*32;
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[14*8+anim%imgVal].bitmap, NULL, su, &bufr);
|
||||
SDL_BlitSurface(CGI->heroh->flags4[themp->getOwner()]->ourImages[14*8+heroAnim%imgVal].bitmap, NULL, su, &bufr);
|
||||
themp->flagPrinted = true;
|
||||
}
|
||||
break;
|
||||
|
@@ -98,7 +98,7 @@ public:
|
||||
void prepareFOWDefs();
|
||||
void randomizeObjects();
|
||||
|
||||
SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0, unsigned char anim=0, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap = CGI->mh->visibility);
|
||||
SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0, unsigned char anim=0, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap = CGI->mh->visibility, bool otherHeroAnim = false, unsigned char heroAnim = 0);
|
||||
SDL_Surface * terrBitmap(int x, int y);
|
||||
SDL_Surface * undTerrBitmap(int x, int y);
|
||||
std::string getRandomizedDefName(CGDefInfo* di, CGObjectInstance * obj = NULL); //objinstance needed only for heroes and towns
|
||||
|
Reference in New Issue
Block a user