mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-24 03:47:18 +02:00
* VCMI no longer needs h3bitmap and h3sprite folders - delete them. Now everything is readed directly from lod files
* names of lods changed - rename your lod files to h3sprite.lod and h3bitmap.lod and place them in \Data subfolder (as in H3). * added several clickable buttons to adv. map interface * underground/surface switch button is functional * reading more text from ZELP.txt, added CPreGameTextHandler to CGameInfo * a lot of minor improvements/fixes(/bugs)
This commit is contained in:
parent
ae279c79c5
commit
6b0f209626
@ -1,36 +1,57 @@
|
||||
#include "stdafx.h"
|
||||
#include "CAdvmapInterface.h"
|
||||
|
||||
CAdvMapInt::CAdvMapInt(int Player)
|
||||
:player(Player)
|
||||
{
|
||||
bg = CGI->bitmaph->loadBitmap("ADVMAP.bmp");
|
||||
blueToPlayersAdv(bg,player);
|
||||
scrollingLeft = false;
|
||||
scrollingRight = false;
|
||||
scrollingUp = false ;
|
||||
scrollingDown = false ;
|
||||
updateScreen = false;
|
||||
anim=0;
|
||||
animValHitCount=0; //animation frame
|
||||
|
||||
gems.push_back(CGI->spriteh->giveDef("agemLL.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemLR.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemUL.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemUR.def"));
|
||||
}
|
||||
CAdvMapInt::~CAdvMapInt()
|
||||
{
|
||||
SDL_FreeSurface(bg);
|
||||
}
|
||||
|
||||
AdventureMapButton::AdventureMapButton ()
|
||||
{
|
||||
type=2;
|
||||
abs=true;
|
||||
active=false;
|
||||
ourObj=NULL;
|
||||
state=0;
|
||||
}
|
||||
AdventureMapButton::AdventureMapButton
|
||||
( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)(), int x, int y, std::string defName, bool activ )
|
||||
{
|
||||
type=2;
|
||||
abs=true;
|
||||
active=false;
|
||||
ourObj=NULL;
|
||||
state=0;
|
||||
int est = LOCPLINT->playerID;
|
||||
CDefHandler * temp = CGI->spriteh->giveDef(defName); //todo: moze cieknac
|
||||
for (int i=0;i<temp->ourImages.size();i++)
|
||||
{
|
||||
imgs.push_back(temp->ourImages[i].bitmap);
|
||||
blueToPlayersAdv(imgs[i],LOCPLINT->playerID);
|
||||
}
|
||||
function = Function;
|
||||
pos.x=x;
|
||||
pos.y=y;
|
||||
pos.w = imgs[0]->w;
|
||||
pos.h = imgs[0]->h;
|
||||
if (activ)
|
||||
activate();
|
||||
}
|
||||
|
||||
void AdventureMapButton::clickLeft (tribool down)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
state=1;
|
||||
else state=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
state=0;
|
||||
}
|
||||
show();
|
||||
int i;
|
||||
if (pressedL && (down==false))
|
||||
(LOCPLINT->adventureInt->*function)();
|
||||
pressedL=state;
|
||||
}
|
||||
void AdventureMapButton::clickRight (tribool down)
|
||||
{
|
||||
@ -42,6 +63,8 @@ void AdventureMapButton::hover (bool on)
|
||||
}
|
||||
void AdventureMapButton::activate()
|
||||
{
|
||||
if (active) return;
|
||||
active=true;
|
||||
ClickableL::activate();
|
||||
Hoverable::activate();
|
||||
KeyInterested::activate();
|
||||
@ -52,18 +75,13 @@ void AdventureMapButton::keyPressed (SDL_KeyboardEvent & key)
|
||||
}
|
||||
void AdventureMapButton::deactivate()
|
||||
{
|
||||
if (!active) return;
|
||||
active=false;
|
||||
ClickableL::deactivate();
|
||||
Hoverable::deactivate();
|
||||
KeyInterested::deactivate();
|
||||
}
|
||||
AdventureMapButton::AdventureMapButton ()
|
||||
{
|
||||
type=2;
|
||||
abs=true;
|
||||
active=false;
|
||||
ourObj=NULL;
|
||||
state=0;
|
||||
}
|
||||
|
||||
void CList::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
@ -81,7 +99,13 @@ void CList::deactivate()
|
||||
void CList::clickLeft(tribool down)
|
||||
{
|
||||
};
|
||||
void CStatusBar::print(std::string text)
|
||||
{
|
||||
|
||||
}
|
||||
void CStatusBar::show()
|
||||
{
|
||||
}
|
||||
void CTerrainRect::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
@ -103,22 +127,130 @@ void CTerrainRect::keyPressed (SDL_KeyboardEvent & key){}
|
||||
void CTerrainRect::show()
|
||||
{
|
||||
SDL_Surface * teren = CGI->mh->terrainRect
|
||||
(CURPLINT->adventureInt->position.x,CURPLINT->adventureInt->position.y,
|
||||
19,18,CURPLINT->adventureInt->position.z,CURPLINT->adventureInt->anim);
|
||||
(LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
|
||||
19,18,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim);
|
||||
SDL_BlitSurface(teren,&genRect(547,594,0,0),ekran,&genRect(547,594,7,6));
|
||||
SDL_FreeSurface(teren);
|
||||
}
|
||||
|
||||
CAdvMapInt::CAdvMapInt(int Player)
|
||||
:player(Player),
|
||||
statusbar(8,556),
|
||||
kingOverview(CGI->preth->advKingdomOverview.first,CGI->preth->advKingdomOverview.second,
|
||||
&CAdvMapInt::fshowOverview, 679, 196, "IAM002.DEF"),
|
||||
|
||||
undeground(CGI->preth->advSurfaceSwitch.first,CGI->preth->advSurfaceSwitch.second,
|
||||
&CAdvMapInt::fswitchLevel, 711, 196, "IAM003.DEF"),
|
||||
|
||||
questlog(CGI->preth->advQuestlog.first,CGI->preth->advQuestlog.second,
|
||||
&CAdvMapInt::fshowQuestlog, 679, 228, "IAM004.DEF"),
|
||||
|
||||
sleepWake(CGI->preth->advSleepWake.first,CGI->preth->advSleepWake.second,
|
||||
&CAdvMapInt::fsleepWake, 711, 228, "IAM005.DEF"),
|
||||
|
||||
moveHero(CGI->preth->advMoveHero.first,CGI->preth->advMoveHero.second,
|
||||
&CAdvMapInt::fmoveHero, 679, 260, "IAM006.DEF"),
|
||||
|
||||
spellbook(CGI->preth->advCastSpell.first,CGI->preth->advCastSpell.second,
|
||||
&CAdvMapInt::fshowSpellbok, 711, 260, "IAM007.DEF"),
|
||||
|
||||
advOptions(CGI->preth->advAdvOptions.first,CGI->preth->advAdvOptions.second,
|
||||
&CAdvMapInt::fadventureOPtions, 679, 292, "IAM008.DEF"),
|
||||
|
||||
sysOptions(CGI->preth->advSystemOptions.first,CGI->preth->advSystemOptions.second,
|
||||
&CAdvMapInt::fsystemOptions, 711, 292, "IAM009.DEF"),
|
||||
|
||||
nextHero(CGI->preth->advNextHero.first,CGI->preth->advNextHero.second,
|
||||
&CAdvMapInt::fnextHero, 679, 324, "IAM000.DEF"),
|
||||
|
||||
endTurn(CGI->preth->advEndTurn.first,CGI->preth->advEndTurn.second,
|
||||
&CAdvMapInt::fendTurn, 679, 356, "IAM001.DEF")
|
||||
{
|
||||
bg = CGI->bitmaph->loadBitmap("ADVMAP.bmp");
|
||||
blueToPlayersAdv(bg,player);
|
||||
scrollingLeft = false;
|
||||
scrollingRight = false;
|
||||
scrollingUp = false ;
|
||||
scrollingDown = false ;
|
||||
updateScreen = false;
|
||||
anim=0;
|
||||
animValHitCount=0; //animation frame
|
||||
|
||||
gems.push_back(CGI->spriteh->giveDef("agemLL.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemLR.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemUL.def"));
|
||||
gems.push_back(CGI->spriteh->giveDef("agemUR.def"));
|
||||
}
|
||||
|
||||
void CAdvMapInt::fshowOverview()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fswitchLevel()
|
||||
{
|
||||
if(!CGI->ac->map.twoLevel)
|
||||
return;
|
||||
if (position.z)
|
||||
position.z--;
|
||||
else position.z++;
|
||||
updateScreen = true;
|
||||
}
|
||||
void CAdvMapInt::fshowQuestlog()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fsleepWake()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fmoveHero()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fshowSpellbok()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fadventureOPtions()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fsystemOptions()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fnextHero()
|
||||
{
|
||||
}
|
||||
void CAdvMapInt::fendTurn()
|
||||
{
|
||||
}
|
||||
|
||||
void CAdvMapInt::show()
|
||||
{
|
||||
blitAt(bg,0,0);
|
||||
|
||||
kingOverview.show();
|
||||
kingOverview.activate();
|
||||
undeground.show();
|
||||
undeground.activate();
|
||||
questlog.show();
|
||||
questlog.activate();
|
||||
sleepWake.show();
|
||||
sleepWake.activate();
|
||||
moveHero.show();
|
||||
moveHero.activate();
|
||||
spellbook.show();
|
||||
spellbook.activate();
|
||||
advOptions.show();
|
||||
advOptions.activate();
|
||||
sysOptions.show();
|
||||
sysOptions.activate();
|
||||
nextHero.show();
|
||||
nextHero.activate();
|
||||
endTurn.show();
|
||||
endTurn.activate();
|
||||
SDL_Flip(ekran);
|
||||
}
|
||||
void CAdvMapInt::update()
|
||||
{
|
||||
terrain.show();
|
||||
blitAt(gems[2]->ourImages[CURPLINT->playerID].bitmap,6,6);
|
||||
blitAt(gems[0]->ourImages[CURPLINT->playerID].bitmap,6,508);
|
||||
blitAt(gems[1]->ourImages[CURPLINT->playerID].bitmap,556,508);
|
||||
blitAt(gems[3]->ourImages[CURPLINT->playerID].bitmap,556,6);
|
||||
blitAt(gems[2]->ourImages[LOCPLINT->playerID].bitmap,6,6);
|
||||
blitAt(gems[0]->ourImages[LOCPLINT->playerID].bitmap,6,508);
|
||||
blitAt(gems[1]->ourImages[LOCPLINT->playerID].bitmap,556,508);
|
||||
blitAt(gems[3]->ourImages[LOCPLINT->playerID].bitmap,556,6);
|
||||
updateRect(&genRect(550,600,6,6));
|
||||
}
|
@ -28,12 +28,12 @@ public:
|
||||
void deactivate(); // makes button inactive (but don't deletes)
|
||||
|
||||
AdventureMapButton(); //c-tor
|
||||
AdventureMapButton( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)() );//c-tor
|
||||
AdventureMapButton( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)(), int x, int y, std::string defName, bool activ=false );//c-tor
|
||||
|
||||
};
|
||||
/*****************************/
|
||||
class CList
|
||||
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public CIntObject
|
||||
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject
|
||||
{
|
||||
SDL_Surface * bg;
|
||||
//arrow up, arrow down
|
||||
@ -75,8 +75,14 @@ class CStatusBar
|
||||
{
|
||||
public:
|
||||
SDL_Surface * bg;
|
||||
SDL_Surface * temp;
|
||||
int tx, ty;
|
||||
std::string current;
|
||||
|
||||
CStatusBar(int x, int y)
|
||||
{bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");pos.x=x;pos.y=y;pos.w=bg->w;pos.h=bg->h;temp=NULL;}
|
||||
void print(std::string text);
|
||||
void show();
|
||||
};
|
||||
class CMinimap
|
||||
: public ClickableL, public ClickableR, public Hoverable, public CIntObject
|
||||
@ -138,11 +144,24 @@ public:
|
||||
endTurn;//- end turn
|
||||
//CHeroList herolist;
|
||||
|
||||
CTerrainRect terrain;
|
||||
|
||||
void show();
|
||||
CTerrainRect terrain; //visible terrain
|
||||
|
||||
void update();
|
||||
CStatusBar statusbar;
|
||||
|
||||
//fuctions binded to buttons
|
||||
void fshowOverview();
|
||||
void fswitchLevel();
|
||||
void fshowQuestlog();
|
||||
void fsleepWake();
|
||||
void fmoveHero();
|
||||
void fshowSpellbok();
|
||||
void fadventureOPtions();
|
||||
void fsystemOptions();
|
||||
void fnextHero();
|
||||
void fendTurn();
|
||||
|
||||
void show(); //shows and activates adv. map interface
|
||||
void update(); //redraws terrain
|
||||
|
||||
|
||||
};
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
CSpellHandler * spellh;
|
||||
CMapHandler * mh;
|
||||
CAmbarCendamo * ac;
|
||||
CPreGameTextHandler * preth ;
|
||||
CBuildingHandler * buildh;
|
||||
CObjectHandler * objh;
|
||||
CMusicHandler * mush;
|
||||
@ -50,6 +51,7 @@ public:
|
||||
CLodHandler * spriteh;
|
||||
CLodHandler * bitmaph;
|
||||
CGeneralTextHandler * generaltexth;
|
||||
int localPlayer;
|
||||
std::vector<CGameInterface *> playerint;
|
||||
std::vector<SDL_Color> playerColors;
|
||||
SDL_Color neutralColor;
|
||||
|
@ -15,7 +15,7 @@ CButtonBase::CButtonBase()
|
||||
}
|
||||
void CButtonBase::show()
|
||||
{
|
||||
if (!abs)
|
||||
if (abs)
|
||||
{
|
||||
blitAt(imgs[state],pos.x,pos.y);
|
||||
updateRect(&pos);
|
||||
@ -29,108 +29,115 @@ void CButtonBase::show()
|
||||
}
|
||||
void ClickableL::activate()
|
||||
{
|
||||
CURPLINT->lclickable.push_back(this);
|
||||
LOCPLINT->lclickable.push_back(this);
|
||||
}
|
||||
void ClickableL::deactivate()
|
||||
{
|
||||
CURPLINT->lclickable.erase
|
||||
(std::find(CURPLINT->lclickable.begin(),CURPLINT->lclickable.end(),this));
|
||||
LOCPLINT->lclickable.erase
|
||||
(std::find(LOCPLINT->lclickable.begin(),LOCPLINT->lclickable.end(),this));
|
||||
}
|
||||
void ClickableR::activate()
|
||||
{
|
||||
CURPLINT->rclickable.push_back(this);
|
||||
LOCPLINT->rclickable.push_back(this);
|
||||
}
|
||||
void ClickableR::deactivate()
|
||||
{
|
||||
CURPLINT->rclickable.erase(std::find(CURPLINT->rclickable.begin(),CURPLINT->rclickable.end(),this));
|
||||
LOCPLINT->rclickable.erase(std::find(LOCPLINT->rclickable.begin(),LOCPLINT->rclickable.end(),this));
|
||||
}
|
||||
void Hoverable::activate()
|
||||
{
|
||||
CURPLINT->hoverable.push_back(this);
|
||||
LOCPLINT->hoverable.push_back(this);
|
||||
}
|
||||
void Hoverable::deactivate()
|
||||
{
|
||||
CURPLINT->hoverable.erase(std::find(CURPLINT->hoverable.begin(),CURPLINT->hoverable.end(),this));
|
||||
LOCPLINT->hoverable.erase(std::find(LOCPLINT->hoverable.begin(),LOCPLINT->hoverable.end(),this));
|
||||
}
|
||||
void KeyInterested::activate()
|
||||
{
|
||||
CURPLINT->keyinterested.push_back(this);
|
||||
LOCPLINT->keyinterested.push_back(this);
|
||||
}
|
||||
void KeyInterested::deactivate()
|
||||
{
|
||||
CURPLINT->
|
||||
keyinterested.erase(std::find(CURPLINT->keyinterested.begin(),CURPLINT->keyinterested.end(),this));
|
||||
LOCPLINT->
|
||||
keyinterested.erase(std::find(LOCPLINT->keyinterested.begin(),LOCPLINT->keyinterested.end(),this));
|
||||
}
|
||||
CPlayerInterface::CPlayerInterface(int Player)
|
||||
CPlayerInterface::CPlayerInterface(int Player, int serial)
|
||||
{
|
||||
playerID=Player;
|
||||
serialID=serial;
|
||||
CGI->localPlayer = playerID;
|
||||
human=true;
|
||||
adventureInt = new CAdvMapInt(Player);
|
||||
}
|
||||
void CPlayerInterface::init()
|
||||
{
|
||||
CGI->localPlayer = serialID;
|
||||
adventureInt = new CAdvMapInt(playerID);
|
||||
}
|
||||
void CPlayerInterface::yourTurn()
|
||||
{
|
||||
unsigned char & animVal = CURPLINT->adventureInt->anim; //for animations handling
|
||||
CGI->localPlayer = serialID;
|
||||
unsigned char & animVal = LOCPLINT->adventureInt->anim; //for animations handling
|
||||
adventureInt->show();
|
||||
//show rest of things
|
||||
|
||||
//initializing framerate keeper
|
||||
FPSmanager * mainLoopFramerateKeeper = new FPSmanager;
|
||||
SDL_initFramerate(mainLoopFramerateKeeper);
|
||||
SDL_setFramerate(mainLoopFramerateKeeper, 30);
|
||||
SDL_setFramerate(mainLoopFramerateKeeper, 24);
|
||||
SDL_Event sEvent;
|
||||
//framerate keeper initialized
|
||||
for(;;) // main loop
|
||||
{
|
||||
|
||||
CURPLINT->adventureInt->updateScreen = false;
|
||||
LOCPLINT->adventureInt->updateScreen = false;
|
||||
if(SDL_PollEvent(&sEvent)) //wait for event...
|
||||
{
|
||||
handleEvent(&sEvent);
|
||||
}
|
||||
++CURPLINT->adventureInt->animValHitCount; //for animations
|
||||
if(CURPLINT->adventureInt->animValHitCount == 2)
|
||||
++LOCPLINT->adventureInt->animValHitCount; //for animations
|
||||
if(LOCPLINT->adventureInt->animValHitCount == 2)
|
||||
{
|
||||
CURPLINT->adventureInt->animValHitCount = 0;
|
||||
LOCPLINT->adventureInt->animValHitCount = 0;
|
||||
++animVal;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
|
||||
}
|
||||
if(CURPLINT->adventureInt->scrollingLeft)
|
||||
if(LOCPLINT->adventureInt->scrollingLeft)
|
||||
{
|
||||
if(CURPLINT->adventureInt->position.x>0)
|
||||
if(LOCPLINT->adventureInt->position.x>0)
|
||||
{
|
||||
CURPLINT->adventureInt->position.x--;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
LOCPLINT->adventureInt->position.x--;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
}
|
||||
}
|
||||
if(CURPLINT->adventureInt->scrollingRight)
|
||||
if(LOCPLINT->adventureInt->scrollingRight)
|
||||
{
|
||||
if(CURPLINT->adventureInt->position.x<CGI->ac->map.width-19+8)
|
||||
if(LOCPLINT->adventureInt->position.x<CGI->ac->map.width-19+8)
|
||||
{
|
||||
CURPLINT->adventureInt->position.x++;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
LOCPLINT->adventureInt->position.x++;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
}
|
||||
}
|
||||
if(CURPLINT->adventureInt->scrollingUp)
|
||||
if(LOCPLINT->adventureInt->scrollingUp)
|
||||
{
|
||||
if(CURPLINT->adventureInt->position.y>0)
|
||||
if(LOCPLINT->adventureInt->position.y>0)
|
||||
{
|
||||
CURPLINT->adventureInt->position.y--;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
LOCPLINT->adventureInt->position.y--;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
}
|
||||
}
|
||||
if(CURPLINT->adventureInt->scrollingDown)
|
||||
if(LOCPLINT->adventureInt->scrollingDown)
|
||||
{
|
||||
if(CURPLINT->adventureInt->position.y<CGI->ac->map.height-18+8)
|
||||
if(LOCPLINT->adventureInt->position.y<CGI->ac->map.height-18+8)
|
||||
{
|
||||
CURPLINT->adventureInt->position.y++;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
LOCPLINT->adventureInt->position.y++;
|
||||
LOCPLINT->adventureInt->updateScreen = true;
|
||||
}
|
||||
}
|
||||
if(CURPLINT->adventureInt->updateScreen)
|
||||
if(LOCPLINT->adventureInt->updateScreen)
|
||||
{
|
||||
adventureInt->update();
|
||||
CURPLINT->adventureInt->updateScreen=false;
|
||||
LOCPLINT->adventureInt->updateScreen=false;
|
||||
}
|
||||
SDL_Delay(5); //give time for other apps
|
||||
SDL_framerateDelay(mainLoopFramerateKeeper);
|
||||
@ -151,22 +158,22 @@ void CPlayerInterface::handleEvent(SDL_Event *sEvent)
|
||||
{
|
||||
case SDLK_LEFT:
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingLeft = true;
|
||||
LOCPLINT->adventureInt->scrollingLeft = true;
|
||||
break;
|
||||
}
|
||||
case (SDLK_RIGHT):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingRight = true;
|
||||
LOCPLINT->adventureInt->scrollingRight = true;
|
||||
break;
|
||||
}
|
||||
case (SDLK_UP):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingUp = true;
|
||||
LOCPLINT->adventureInt->scrollingUp = true;
|
||||
break;
|
||||
}
|
||||
case (SDLK_DOWN):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingDown = true;
|
||||
LOCPLINT->adventureInt->scrollingDown = true;
|
||||
break;
|
||||
}
|
||||
case (SDLK_q):
|
||||
@ -176,13 +183,7 @@ void CPlayerInterface::handleEvent(SDL_Event *sEvent)
|
||||
}
|
||||
case (SDLK_u):
|
||||
{
|
||||
if(!CGI->ac->map.twoLevel)
|
||||
break;
|
||||
if (adventureInt->position.z)
|
||||
adventureInt->position.z--;
|
||||
else adventureInt->position.z++;
|
||||
CURPLINT->adventureInt->updateScreen = true;
|
||||
break;
|
||||
adventureInt->undeground.clickLeft(true);
|
||||
}
|
||||
}
|
||||
} //keydown end
|
||||
@ -192,59 +193,99 @@ void CPlayerInterface::handleEvent(SDL_Event *sEvent)
|
||||
{
|
||||
case SDLK_LEFT:
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingLeft = false;
|
||||
LOCPLINT->adventureInt->scrollingLeft = false;
|
||||
break;
|
||||
}
|
||||
case (SDLK_RIGHT):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingRight = false;
|
||||
LOCPLINT->adventureInt->scrollingRight = false;
|
||||
break;
|
||||
}
|
||||
case (SDLK_UP):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingUp = false;
|
||||
LOCPLINT->adventureInt->scrollingUp = false;
|
||||
break;
|
||||
}
|
||||
case (SDLK_DOWN):
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingDown = false;
|
||||
LOCPLINT->adventureInt->scrollingDown = false;
|
||||
break;
|
||||
}
|
||||
case (SDLK_u):
|
||||
{
|
||||
adventureInt->undeground.clickLeft(false);
|
||||
}
|
||||
}
|
||||
}//keyup end
|
||||
else if(sEvent->type==SDL_MOUSEMOTION)
|
||||
{
|
||||
for (int i=0; i<hoverable.size();i++)
|
||||
{
|
||||
if (isItIn(&hoverable[i]->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
if (!hoverable[i]->hovered)
|
||||
hoverable[i]->hover(true);
|
||||
}
|
||||
else if (hoverable[i]->hovered)
|
||||
{
|
||||
hoverable[i]->hover(false);
|
||||
}
|
||||
}
|
||||
if(sEvent->motion.x<15)
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingLeft = true;
|
||||
LOCPLINT->adventureInt->scrollingLeft = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingLeft = false;
|
||||
LOCPLINT->adventureInt->scrollingLeft = false;
|
||||
}
|
||||
if(sEvent->motion.x>ekran->w-15)
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingRight = true;
|
||||
LOCPLINT->adventureInt->scrollingRight = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingRight = false;
|
||||
LOCPLINT->adventureInt->scrollingRight = false;
|
||||
}
|
||||
if(sEvent->motion.y<15)
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingUp = true;
|
||||
LOCPLINT->adventureInt->scrollingUp = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingUp = false;
|
||||
LOCPLINT->adventureInt->scrollingUp = false;
|
||||
}
|
||||
if(sEvent->motion.y>ekran->h-15)
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingDown = true;
|
||||
LOCPLINT->adventureInt->scrollingDown = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CURPLINT->adventureInt->scrollingDown = false;
|
||||
LOCPLINT->adventureInt->scrollingDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONDOWN) && (sEvent->button.button == SDL_BUTTON_LEFT))
|
||||
{
|
||||
for(int i=0; i<lclickable.size();i++)
|
||||
{
|
||||
if (isItIn(&lclickable[i]->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
lclickable[i]->clickLeft(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT))
|
||||
{
|
||||
for(int i=0; i<lclickable.size();i++)
|
||||
{
|
||||
if (isItIn(&lclickable[i]->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
lclickable[i]->clickLeft(false);
|
||||
}
|
||||
else
|
||||
lclickable[i]->clickLeft(boost::logic::indeterminate);
|
||||
}
|
||||
}
|
||||
|
||||
} //event end
|
@ -15,7 +15,7 @@ public:
|
||||
SDL_Rect pos;
|
||||
int ID;
|
||||
};
|
||||
class CButtonBase : public CIntObject
|
||||
class CButtonBase : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
int type; //advmapbutton=2
|
||||
@ -29,23 +29,23 @@ public:
|
||||
virtual void deactivate()=0;
|
||||
CButtonBase();
|
||||
};
|
||||
class ClickableL //for left-clicks
|
||||
class ClickableL : public virtual CIntObject //for left-clicks
|
||||
{
|
||||
public:
|
||||
bool pressed;
|
||||
bool pressedL;
|
||||
virtual void clickLeft (tribool down)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class ClickableR //for right-clicks
|
||||
class ClickableR : public virtual CIntObject //for right-clicks
|
||||
{
|
||||
public:
|
||||
bool pressed;
|
||||
bool pressedR;
|
||||
virtual void clickRight (tribool down)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class Hoverable
|
||||
class Hoverable : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
bool hovered;
|
||||
@ -53,7 +53,7 @@ public:
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class KeyInterested
|
||||
class KeyInterested : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
virtual void keyPressed (SDL_KeyboardEvent & key)=0;
|
||||
@ -64,7 +64,7 @@ class CGameInterface
|
||||
{
|
||||
public:
|
||||
bool human;
|
||||
int playerID;
|
||||
int playerID, serialID;
|
||||
|
||||
virtual void yourTurn()=0{};
|
||||
};
|
||||
@ -86,7 +86,8 @@ public:
|
||||
|
||||
void yourTurn();
|
||||
void handleEvent(SDL_Event * sEvent);
|
||||
void init();
|
||||
|
||||
CPlayerInterface(int Player);
|
||||
CPlayerInterface(int Player, int serial);
|
||||
};
|
||||
#endif //CGAMEINTERFACE_H
|
12
CMT.cpp
12
CMT.cpp
@ -240,9 +240,9 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
THC std::cout<<"Initializing screen, fonts and sound handling: "<<tmh.getDif()<<std::endl;
|
||||
cgi->spriteh = new CLodHandler;
|
||||
cgi->spriteh->init(std::string("newH3sprite.lod"));
|
||||
cgi->spriteh->init(std::string("Data\\H3sprite.lod"));
|
||||
cgi->bitmaph = new CLodHandler;
|
||||
cgi->bitmaph->init(std::string("newH3bitmap.lod"));
|
||||
cgi->bitmaph->init(std::string("Data\\H3bitmap.lod"));
|
||||
|
||||
//colors initialization
|
||||
SDL_Color p;
|
||||
@ -366,7 +366,11 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if(cgi->scenarioOps.playerInfos[i].name=="AI")
|
||||
cgi->playerint.push_back(new CGlobalAI());
|
||||
else cgi->playerint.push_back(new CPlayerInterface(cgi->scenarioOps.playerInfos[i].color));
|
||||
else
|
||||
{
|
||||
cgi->playerint.push_back(new CPlayerInterface(cgi->scenarioOps.playerInfos[i].color,i));
|
||||
((CPlayerInterface*)(cgi->playerint[i]))->init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -554,7 +558,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
updateScreen = true;
|
||||
++animValHitCount; //for animations
|
||||
if(animValHitCount == 2)
|
||||
if(animValHitCount == 4)
|
||||
{
|
||||
animValHitCount = 0;
|
||||
++animVal;
|
||||
|
@ -1,31 +1,17 @@
|
||||
#include "stdafx.h"
|
||||
#include "CObjectHandler.h"
|
||||
#include "CGameInfo.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
|
||||
void CObjectHandler::loadObjects()
|
||||
{
|
||||
std::ifstream inp("H3bitmap.lod\\OBJNAMES.TXT", std::ios::in | std::ios::binary);
|
||||
inp.seekg(0,std::ios::end); // na koniec
|
||||
int andame = inp.tellg(); // read length
|
||||
inp.seekg(0,std::ios::beg); // wracamy na poczatek
|
||||
char * bufor = new char[andame]; // allocate memory
|
||||
inp.read((char*)bufor, andame); // read map file to buffer
|
||||
inp.close();
|
||||
std::string buf = std::string(bufor);
|
||||
delete [andame] bufor;
|
||||
int i = 0; //buf iterator
|
||||
while(!inp.eof())
|
||||
int ID=0;
|
||||
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("OBJNAMES.TXT");
|
||||
int it=0;
|
||||
while (it<buf.length()-1)
|
||||
{
|
||||
if(objects.size()>200 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos)
|
||||
break;
|
||||
CObject nobj;
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
nobj.name = buf.substr(befi, i-befi);
|
||||
i+=2;
|
||||
CGeneralTextHandler::loadToIt(nobj.name,buf,it,3);
|
||||
objects.push_back(nobj);
|
||||
}
|
||||
}
|
BIN
CPreGame.cpp
BIN
CPreGame.cpp
Binary file not shown.
@ -22,18 +22,10 @@ std::string CPreGameTextHandler::getDescr(std::string text)
|
||||
}
|
||||
void CPreGameTextHandler::loadTexts()
|
||||
{
|
||||
std::ifstream inp("H3bitmap.lod\\ZELP.TXT", std::ios::in|std::ios::binary);
|
||||
inp.seekg(0,std::ios::end); // na koniec
|
||||
int andame = inp.tellg(); // read length
|
||||
inp.seekg(0,std::ios::beg); // wracamy na poczatek
|
||||
char * bufor = new char[andame]; // allocate memory
|
||||
inp.read((char*)bufor, andame); // read map file to buffer
|
||||
inp.close();
|
||||
std::string buf = std::string(bufor);
|
||||
delete [andame] bufor;
|
||||
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("ZELP.TXT");
|
||||
int i=0; //buf iterator
|
||||
int hmcr=0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -43,7 +35,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -52,7 +44,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -62,7 +54,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -71,7 +63,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -81,7 +73,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -90,7 +82,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -100,7 +92,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -109,7 +101,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -119,7 +111,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -128,7 +120,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -138,7 +130,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -147,7 +139,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -157,7 +149,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -166,7 +158,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -176,7 +168,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -185,7 +177,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -195,7 +187,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -204,7 +196,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -214,7 +206,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
i+=3;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\t')
|
||||
break;
|
||||
@ -223,7 +215,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
++i;
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -399,7 +391,7 @@ void CPreGameTextHandler::loadTexts()
|
||||
loadToIt(singleStartingBonusHeaderID, buf, i, 0);
|
||||
|
||||
hmcr = 0;
|
||||
for(i; i<andame; ++i)
|
||||
for(i; i<buf.length(); ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
@ -425,6 +417,35 @@ void CPreGameTextHandler::loadTexts()
|
||||
std::string dump;
|
||||
loadToIt(dump, buf, i, 1);
|
||||
loadToIt(multiCancel, buf, i, 0);
|
||||
loadToIt(dump, buf, i, 0);
|
||||
loadToIt(dump, buf, i, 4);
|
||||
loadToIt(dump, buf, i, 2);
|
||||
|
||||
loadToIt(advWorldMap.first, buf, i, 4);
|
||||
loadToIt(advWorldMap.second, buf, i, 2);
|
||||
loadToIt(advStatusWindow1.first, buf, i, 4);
|
||||
loadToIt(advStatusWindow1.second, buf, i, 2);
|
||||
loadToIt(advKingdomOverview.first, buf, i, 4);
|
||||
loadToIt(advKingdomOverview.second, buf, i, 2);
|
||||
loadToIt(advSurfaceSwitch.first, buf, i, 4);
|
||||
loadToIt(advSurfaceSwitch.second, buf, i, 2);
|
||||
loadToIt(advQuestlog.first, buf, i, 4);
|
||||
loadToIt(advQuestlog.second, buf, i, 2);
|
||||
loadToIt(advSleepWake.first, buf, i, 4);
|
||||
loadToIt(advSleepWake.second, buf, i, 2);
|
||||
loadToIt(advMoveHero.first, buf, i, 4);
|
||||
loadToIt(advMoveHero.second, buf, i, 2);
|
||||
loadToIt(advCastSpell.first, buf, i, 4);
|
||||
loadToIt(advCastSpell.second, buf, i, 2);
|
||||
loadToIt(advAdvOptions.first, buf, i, 4);
|
||||
loadToIt(advAdvOptions.second, buf, i, 2);
|
||||
loadToIt(advSystemOptions.first, buf, i, 4);
|
||||
loadToIt(advSystemOptions.second, buf, i, 2);
|
||||
loadToIt(advNextHero.first, buf, i, 4);
|
||||
loadToIt(advNextHero.second, buf, i, 2);
|
||||
loadToIt(advEndTurn.first, buf, i, 4);
|
||||
loadToIt(advEndTurn.second, buf, i, 2);
|
||||
|
||||
loadLossConditions();
|
||||
loadVictoryConditions();
|
||||
}
|
||||
@ -485,6 +506,53 @@ void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &ite
|
||||
}
|
||||
dest = src.substr(befi, iter-befi);
|
||||
iter+=2;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
int befi=iter;
|
||||
for(iter; iter<src.size(); ++iter)
|
||||
{
|
||||
if(src[iter]=='\t')
|
||||
break;
|
||||
}
|
||||
dest = src.substr(befi, iter-befi);
|
||||
++iter;
|
||||
|
||||
int hmcr = 0;
|
||||
for(iter; iter<src.size(); ++iter)
|
||||
{
|
||||
if(src[iter]=='\r')
|
||||
++hmcr;
|
||||
if(hmcr==1)
|
||||
break;
|
||||
}
|
||||
iter+=2;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
int befi=iter;
|
||||
for(iter; iter<src.size(); ++iter)
|
||||
{
|
||||
if(src[iter]=='\r')
|
||||
break;
|
||||
}
|
||||
dest = src.substr(befi, iter-befi);
|
||||
iter+=2;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
int befi=iter;
|
||||
for(iter; iter<src.size(); ++iter)
|
||||
{
|
||||
if(src[iter]=='\t')
|
||||
break;
|
||||
}
|
||||
dest = src.substr(befi, iter-befi);
|
||||
iter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//loadLossConditions();
|
||||
|
@ -37,8 +37,13 @@ public:
|
||||
|
||||
std::string getTitle(std::string text);
|
||||
std::string getDescr(std::string text);
|
||||
|
||||
std::pair<std::string, std::string> //first is statusbar text, second right-click help; they're all for adventure map interface
|
||||
advKingdomOverview, advSurfaceSwitch, advQuestlog, advSleepWake, advMoveHero, advCastSpell, advAdvOptions, advSystemOptions, advNextHero, advEndTurn, //buttons
|
||||
advWorldMap, advStatusWindow1;
|
||||
|
||||
void loadTexts();
|
||||
void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol
|
||||
void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol //mode 2 - copy to tab, dump to eol //mode 3 - copy to eol //mode 4 - copy to tab
|
||||
void loadVictoryConditions();
|
||||
void loadLossConditions();
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
bool isItIn(const SDL_Rect * rect, int x, int y)
|
||||
{
|
||||
if ((x>rect->x && x<rect->x+rect->w) && (y>rect->y && y<rect->y+rect->h))
|
||||
@ -598,4 +599,21 @@ void CSDL_Ext::setPlayerColor(SDL_Surface * sur, int player)
|
||||
else
|
||||
*(sur->format->palette->colors+5) = CGameInfo::mainObj->neutralColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
int readNormalNr (std::istream &in, int bytCon)
|
||||
{
|
||||
int ret=0;
|
||||
int amp=1;
|
||||
unsigned char byte;
|
||||
if (in.good())
|
||||
{
|
||||
for (int i=0; i<bytCon; i++)
|
||||
{
|
||||
in.read((char*)&byte,1);
|
||||
ret+=byte*amp;
|
||||
amp*=256;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
return ret;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ extern SDL_Color tytulowy, tlo, zwykly ;
|
||||
void blitAtWR(SDL_Surface * src, int x, int y, SDL_Surface * dst=ekran);
|
||||
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=ekran);
|
||||
void updateRect (SDL_Rect * rect, SDL_Surface * scr = ekran);
|
||||
bool isItIn(const SDL_Rect * rect, int x, int y);
|
||||
SDL_Rect genRect(int hh, int ww, int xx, int yy);
|
||||
namespace CSDL_Ext
|
||||
{
|
||||
|
8
global.h
8
global.h
@ -19,7 +19,13 @@ enum ElossCon {lossCastle, lossHero, timeExpires, lossStandard=255};
|
||||
enum EHeroClasses {HERO_KNIGHT, HERO_CLERIC, HERO_RANGER, HERO_DRUID, HREO_ALCHEMIST, HERO_WIZARD,
|
||||
HERO_DEMONIAC, HERO_HERETIC, HERO_DEATHKNIGHT, HERO_NECROMANCER, HERO_WARLOCK, HERO_OVERLORD,
|
||||
HERO_BARBARIAN, HERO_BATTLEMAGE, HERO_BEASTMASTER, HERO_WITCH, HERO_PLANESWALKER, HERO_ELEMENTALIST};
|
||||
#define CURPLINT (((CPlayerInterface*)(CGI->playerint[CGI->state->currentPlayer]))) //interface of current player (only human)
|
||||
|
||||
#define CURPLINT (((CPlayerInterface*)(CGI->playerint[CGI->state->currentPlayer])))
|
||||
#define LOCPLINT (((CPlayerInterface*)(CGI->playerint[CGI->localPlayer])))
|
||||
//CURPLINT gives pointer to the interface of human player which is currently making turn,
|
||||
//LOCPLINT gives pointer to the interface which is currently showed (on this machine)
|
||||
|
||||
|
||||
const int F_NUMBER = 9; //factions quantity
|
||||
const int PLAYER_LIMIT = 8; //player limit per map
|
||||
const int HEROES_PER_TYPE=8; //amount of heroes of each type
|
||||
|
Loading…
x
Reference in New Issue
Block a user