Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

Scourge Class Reference

Inheritance diagram for Scourge:

Inheritance graph
[legend]
Collaboration diagram for Scourge:

Collaboration graph
[legend]

Detailed Description

This is the main class of the game.

It is a central place to put references to other objects, like the party, minimap, etc.

Author:
Gabor Torok


Public Member Functions

void setBlendFunc ()
 Scourge (UserConfiguration *config)
void receive (Widget *widget)
 The widget received a dragged item.
bool startDrag (Widget *widget, int x=0, int y=0)
 The widget initiated a drag return true if there's something to drag at x,y.
int getCurrentDepth ()
bool isHeadless ()
SessiongetSession ()
int getScreenWidth ()
int getScreenHeight ()
Board * getBoard ()
void setMove (Uint16 n)
 Set which direction to move in.
void removeMove (Uint16 n)
 Stop moving in the given direction(s).
void playRound ()
 This method is called by the main loop to play a round.
BattlegetBattle (Creature *creature)
Party * getParty ()
MapgetMap ()
MiniMapgetMiniMap ()
void colorMiniMapPoint (int x, int y, Shape *shape, Location *pos=NULL)
void eraseMiniMapPoint (int x, int y)
void setMovingItem (Item *item, int x, int y, int z)
 When dropping an item from the inventory this method sets up the parameters so the cursor can drag it around the screen and eventually deposit it at a location or in a container.
ItemgetMovingItem ()
MainMenu * getMainMenu ()
OptionsMenu * getOptionsMenu ()
MultiplayerDialog * getMultiplayerDialog ()
Inventory * getInventory ()
void drawView ()
 The main app loop calls this method to repaint the screen.
void drawAfter ()
 The main app loop calls this after the drawView and the UI (windows) have been drawn.
void drawDraggedItem ()
void drawBorder ()
void drawOutsideMap ()
void showCreatureInfo (Creature *creature, bool player, bool selected, bool groupMode)
bool handleEvent (SDL_Event *event)
 Respond to keyboard and mouse events in this method.
bool handleEvent (Widget *widget, SDL_Event *event)
 Respond to UI (windowing) events in this method.
void addGameSpeed (int speedFactor)
 Increase the game speed.
void startItemDragFromGui (Item *item)
 Start to drag an item from a container gui.
bool startItemDrag (int x, int y, int z)
 Start to drag an item from the map at a specific location.
void endItemDrag ()
 Stop dragging an item.
bool useItem (int x, int y, int z)
 Use the item at the given location.
void startMission ()
 Set up a new mission or story of a mission and call sdlHandler->mainLoop() to play it.
void endMission ()
 Set up some variables so the mainLoop can quit and control can be transferred back to startMission.
ShapePalette * getShapePalette ()
SDLHandler * getSDLHandler ()
void openContainerGui (Item *container)
 Open the container UI for the given container item.
void closeContainerGui (ContainerGui *gui)
 Close the specified container gui.
void closeAllContainerGuis ()
 Close all open container guis.
void creatureDeath (Creature *creature)
 A creature has died, mark it dead (via state_mod), and create a "skull and bones" container for it containing the items from the dead creature's inventory.
void showMessageDialog (char *message)
 A helper method to show a message in a modal dialog.
void togglePlayerOnly ()
void toggleInventoryWindow ()
void toggleOptionsWindow ()
void showExitConfirmationDialog ()
 Show the modal yes/no dialog asking the user if the story should be exited.
Window * createWoodWindow (int x, int y, int w, int h, char *title)
 A helper method to create a window with the "wood" look.
Window * createWindow (int x, int y, int w, int h, char *title)
 A helper method to create a window with the default look.
void missionCompleted ()
 Called when the mission was completed (monster killed, item bagged, etc.).
void setTargetSelectionFor (Creature *c)
 Enable "target" mode for a given creature.
Creature * getTargetSelectionFor ()
void setUILayout ()
 Refresh (redraw) the current UI layout.
void setUILayout (int mode)
 Set the UI layout to one of the values specified in constants.
int getLayoutMode ()
void initStart (int statusCount, char *message)
void initUpdate (char *message)
void initEnd ()
void initVideo (ShapePalette *shapePal)
void initUI ()
void start ()
double getFps ()
void playSound (const char *sound)
void loadMonsterSounds (char *type, map< int, vector< string > * > *soundMap)
void unloadMonsterSounds (char *type, map< int, vector< string > * > *soundMap)
void setDebugStr (char *s)
void fightProjectileHitTurn (Projectile *proj, Creature *creature)
void fightProjectileHitTurn (Projectile *proj, int x, int y)
void drawWidget (Widget *w)
void resetPartyUI ()
void refreshInventoryUI (int playerIndex)
void refreshInventoryUI ()
void toggleRoundUI (bool startRound)
void setFormationUI (int formation, bool playerOnly)
void togglePlayerOnlyUI (bool playerOnly)
void setPlayerUI (int index)
void setPlayer (int n)
void createBoardUI ()
void updateBoardUI (int count, const char **missionText, Color *missionColor)
int handleBoardEvent (Widget *widget, SDL_Event *event)
void setMissionDescriptionUI (char *s)
void moveMonster (Creature *monster)
void removeBattle (Battle *battle)
bool inTurnBasedCombat ()
bool inTurnBasedCombatPlayerTurn ()
InfoGui * getInfoGui ()
ConversationGui * getConversationGui ()
void showItemInfoUI (Item *item, int level)
void resetInfos ()
void createParty (Creature **pc, int *partySize)
bool handleTargetSelectionOfCreature (Creature *potentialTarget)
bool handleTargetSelectionOfItem (Item *item, int x=0, int y=0, int z=0)
bool handleTargetSelectionOfLocation (Uint16 mapx, Uint16 mapy, Uint16 mapz)
void teleport (bool toHQ=true)
Window * getPartyWindow ()

Static Public Attributes

static const int PARTY_GUI_WIDTH = 500
static const int PARTY_GUI_HEIGHT = 145
static const int PARTY_MIN_GUI_WIDTH = 100
static const int INVENTORY_WIDTH = 420
static const int INVENTORY_HEIGHT = 460
static int blendA = 2
static int blendB = 6
static int blend []

Protected Member Functions

void processGameMouseDown (Uint16 x, Uint16 y, Uint8 button)
void processGameMouseClick (Uint16 x, Uint16 y, Uint8 button)
void getMapXYZAtScreenXY (Uint16 x, Uint16 y, Uint16 *mapx, Uint16 *mapy, Uint16 *mapz)
void getMapXYAtScreenXY (Uint16 x, Uint16 y, Uint16 *mapx, Uint16 *mapy)
void processGameMouseMove (Uint16 x, Uint16 y)
void describeLocation (int mapx, int mapy, int mapz)
bool getItem (Location *pos)
int dropItem (int x, int y)
bool useLever (Location *pos)
bool useDoor (Location *pos)
void destroyDoor (Sint16 ox, Sint16 oy, Shape *shape)
bool useBoard (Location *pos)
bool useTeleporter (Location *pos)
bool useGate (Location *pos)
void drawPortrait (Widget *w, Creature *p)
void resetBattles ()
int initMultiplayer ()
void decodeName (int name, Uint16 *mapx, Uint16 *mapy, Uint16 *mapz)
void createUI ()
void handleKeyboardMovement ()
void decideMonsterAction (Creature *monster)
void refreshContainerGui (Item *container)
void createPartyUI ()
bool handlePartyEvent (Widget *widget, SDL_Event *event)
void updatePartyUI ()
void moveProjectiles ()
bool fightCurrentBattleTurn ()
void resetNonParticipantAnimation (Battle *battle)
bool createBattleTurns ()
void resetUIAfterBattle ()
void moveCreatures ()
void checkForDropTarget ()
void checkForInfo ()
void drawInfos ()
void quickSpellAction (int index)

Protected Attributes

SDLHandler * sdlHandler
ShapePalette * shapePal


Member Function Documentation

void Scourge::addGameSpeed int  speedFactor  ) 
 

Increase the game speed.

Parameters:
speedFactor add this number to the current game speed.

void Scourge::closeAllContainerGuis  ) 
 

Close all open container guis.

void Scourge::closeContainerGui ContainerGui *  gui  ) 
 

Close the specified container gui.

Window * Scourge::createWindow int  x,
int  y,
int  w,
int  h,
char *  title
 

A helper method to create a window with the default look.

Parameters:
x the window's position on screen
y the window's position on screen
w the window's width
h the window's height
title the window's title

Window * Scourge::createWoodWindow int  x,
int  y,
int  w,
int  h,
char *  title
 

A helper method to create a window with the "wood" look.

(e.g. a container ui)

Parameters:
x the window's position on screen
y the window's position on screen
w the window's width
h the window's height
title the window's title

void Scourge::creatureDeath Creature *  creature  ) 
 

A creature has died, mark it dead (via state_mod), and create a "skull and bones" container for it containing the items from the dead creature's inventory.

Additionally, if the creature was a party member perform some other things like transferring control to another (still living) player.

Parameters:
creature the ex-creature

void Scourge::drawAfter  )  [virtual]
 

The main app loop calls this after the drawView and the UI (windows) have been drawn.

In this implementation, the dragged item is drawn over the map.

Implements SDLScreenView.

void Scourge::drawView  )  [virtual]
 

The main app loop calls this method to repaint the screen.

In this implementation the following happens: the round is played, the map is drawn, the map overlay (circles around the good guys, names of creatues, etc.) is painted and some extra updates to other components (like the minimap, message ui, etc.) occur.

Implements SDLScreenView.

void Scourge::endItemDrag  ) 
 

Stop dragging an item.

void Scourge::endMission  ) 
 

Set up some variables so the mainLoop can quit and control can be transferred back to startMission.

Board* Scourge::getBoard  ) 
 

Returns:
the Board containing the available missions.

Inventory* Scourge::getInventory  ) 
 

Returns:
the inventory

int Scourge::getLayoutMode  ) 
 

Returns:
the current UI layout mode.

MainMenu* Scourge::getMainMenu  ) 
 

Returns:
the main menu

Map* Scourge::getMap  ) 
 

Returns:
the map.

MiniMap* Scourge::getMiniMap  ) 
 

Returns:
the MiniMap.

Item* Scourge::getMovingItem  ) 
 

Returns:
the item currently being dragged by the cursor.

MultiplayerDialog* Scourge::getMultiplayerDialog  ) 
 

Returns:
the multiplayer dialog window

OptionsMenu* Scourge::getOptionsMenu  ) 
 

Returns:
the options menu

Party* Scourge::getParty  ) 
 

Returns:
the party object.

SDLHandler* Scourge::getSDLHandler  ) 
 

Returns:
the SDLHandler.

ShapePalette* Scourge::getShapePalette  ) 
 

Returns:
the ShapePalette.

Creature* Scourge::getTargetSelectionFor  ) 
 

Returns:
who the current target mode is activated for. (ie. the spellcaster)

bool Scourge::handleEvent Widget *  widget,
SDL_Event *  event
 

Respond to UI (windowing) events in this method.

Parameters:
widget The widget which fired the event (e.g.: button, list, etc.)
event the actual SDL_Event structure as captured by the main app loop.
Returns:
true to exit from the current screen, false otherwise

bool Scourge::handleEvent SDL_Event *  event  ) 
 

Respond to keyboard and mouse events in this method.

Parameters:
event the actual SDL_Event structure as captured by the main app loop.
Returns:
true to exit from the current screen, false otherwise

void Scourge::missionCompleted  ) 
 

Called when the mission was completed (monster killed, item bagged, etc.).

This method awards experience points.

void Scourge::openContainerGui Item container  ) 
 

Open the container UI for the given container item.

Parameters:
container the container item whose contents to show in the window.

void Scourge::playRound  ) 
 

This method is called by the main loop to play a round.

A round may consist of a battle with multiple participants, someone drinking a potion, casting a spell, etc.

void Scourge::receive Widget *  widget  )  [virtual]
 

The widget received a dragged item.

Implements DragAndDropHandler.

void Scourge::removeMove Uint16  n  ) 
 

Stop moving in the given direction(s).

Parameters:
n is a bitfield. See constants for directions values.

void Scourge::setMove Uint16  n  ) 
 

Set which direction to move in.

Parameters:
n is a bitfield. See constants for direction values.

void Scourge::setMovingItem Item item,
int  x,
int  y,
int  z
 

When dropping an item from the inventory this method sets up the parameters so the cursor can drag it around the screen and eventually deposit it at a location or in a container.

Parameters:
item The item to drop
x where to drop the item on the map
y where to drop the item on the map
z where to drop the item on the map

void Scourge::setTargetSelectionFor Creature *  c  ) 
 

Enable "target" mode for a given creature.

The cursor changes to a cross-hair.

void Scourge::setUILayout int  mode  ) 
 

Set the UI layout to one of the values specified in constants.

A UI layout is either free-floating (where windows can be dragged anywhere on the screen) or old-school where some windows are "locked". These locked windows are always visible and cannot be moved. The default screen layout is the free-floating mode.

void Scourge::setUILayout  ) 
 

Refresh (redraw) the current UI layout.

void Scourge::showExitConfirmationDialog  ) 
 

Show the modal yes/no dialog asking the user if the story should be exited.

void Scourge::showMessageDialog char *  message  ) 
 

A helper method to show a message in a modal dialog.

bool Scourge::startDrag Widget *  widget,
int  x = 0,
int  y = 0
[virtual]
 

The widget initiated a drag return true if there's something to drag at x,y.

Implements DragAndDropHandler.

bool Scourge::startItemDrag int  x,
int  y,
int  z
 

Start to drag an item from the map at a specific location.

Parameters:
x the position of the item to drag.
y the position of the item to drag.
z the position of the item to drag.

void Scourge::startItemDragFromGui Item item  ) 
 

Start to drag an item from a container gui.

Parameters:
item the item to drag.

void Scourge::startMission  ) 
 

Set up a new mission or story of a mission and call sdlHandler->mainLoop() to play it.

Several things happen here: a new map is created via the DungeonGenerator, the party is placed on it, the UI is set up, etc. After the mission is over (when mainLoop returns) items and creatures created for this story are deleted, the UI is hidden, etc.

bool Scourge::useItem int  x,
int  y,
int  z
 

Use the item at the given location.

This method also selects targets for pending spells. Depending on the type of the item, further methods are called. (e.g.: useDoor, useTeleporter, etc.)

Parameters:
x the location of the item on the map
y the location of the item on the map
z the location of the item on the map


Field Documentation

int Scourge::blend [static]
 

Initial value:

 { 
    GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, 
    GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
    GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA_SATURATE
}


The documentation for this class was generated from the following files:
Generated on Thu Jun 16 21:50:53 2005 for scourge by  doxygen 1.4.0