SBSPSS/source/map/map.h

206 lines
4.2 KiB
C
Raw Normal View History

2001-04-24 18:15:04 +02:00
/*=========================================================================
map.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __MAP_MAP_H__
#define __MAP_MAP_H__
/*----------------------------------------------------------------------
Includes
-------- */
#ifndef __SYSTEM_GSTATE_H__
#include "system\gstate.h"
#endif
2001-04-25 01:14:50 +02:00
#ifndef _GLOBAL_HEADER_
#include "system\global.h" // Doh.. just for DVECTOR :/
#endif
2001-04-24 18:15:04 +02:00
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class CMapScene: public CScene
{
public:
void init();
void shutdown();
void render();
void think(int _frames);
int readyToShutdown();
char *getSceneName() {return"Map";}
2001-06-13 16:28:41 +02:00
static void setLevelToStartOn(int _chapter,int _level) {s_chapterToStartOn=_chapter;s_levelToStartOn=_level;}
2001-04-24 18:15:04 +02:00
private:
2001-04-25 20:15:19 +02:00
enum
{
MAP_LEVEL_WIDTH=140,
MAP_LEVEL_HEIGHT=60,
2001-08-03 01:44:21 +02:00
MAP_INSTRUCTIONS_YSTART=180,
2001-05-31 23:17:33 +02:00
MAP_INSTRUCTIONS_BUTTON_Y_OFFSET=3,
MAP_INSTRUCTIONS_TEXT_R=128,
MAP_INSTRUCTIONS_TEXT_G=64,
MAP_INSTRUCTIONS_TEXT_B=64,
MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS=5,
MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT=10,
2001-07-12 17:21:58 +02:00
MAP_INSTRUCTIONS_Y_SPACE_BETWEEN_LINES=13,
2001-05-30 16:58:29 +02:00
2001-08-09 21:51:18 +02:00
MAP_CHAPTER_ARROW_XOFF=90,
MAP_CHAPTER_ARROW_Y=180,
MAP_CHAPTER_ARROW_RGB_UNSELECTED=50,
MAP_CHAPTER_ARROW_RGB_SELECTED=150,
2001-08-03 01:44:21 +02:00
2001-05-30 16:58:29 +02:00
MAP_NUM_CHAPTERS=5,
MAP_NUM_LEVELS_PER_CHAPTER=5,
2001-04-25 20:15:19 +02:00
};
2001-07-25 18:20:01 +02:00
enum MAP_GFX
{
MAP_GFX_C1_L1=0,
MAP_GFX_C1_L2,
MAP_GFX_C1_L3,
MAP_GFX_C1_L4,
MAP_GFX_C1_FAIR,
MAP_GFX_C2_L1,
MAP_GFX_C2_L2,
MAP_GFX_C2_L3,
MAP_GFX_C2_L4,
MAP_GFX_C2_FAIR,
MAP_GFX_C3_L1,
MAP_GFX_C3_L2,
MAP_GFX_C3_L3,
MAP_GFX_C3_L4,
MAP_GFX_C3_FAIR,
MAP_GFX_C4_L1,
MAP_GFX_C4_L2,
MAP_GFX_C4_L3,
MAP_GFX_C4_L4,
MAP_GFX_C4_FAIR,
MAP_GFX_C5_L1,
MAP_GFX_C5_L2,
MAP_GFX_C5_L3,
MAP_GFX_C5_L4,
MAP_GFX_C5_FAIR,
MAP_GFX_MAX
};
2001-04-25 20:15:19 +02:00
typedef struct
{
2001-07-25 18:20:01 +02:00
MAP_GFX m_Gfx;
2001-05-30 16:58:29 +02:00
int m_globalLevelNumber;
2001-05-31 23:17:33 +02:00
int m_spatulaOrTokenCounts;
2001-05-30 16:58:29 +02:00
int m_questItemFrame;
int m_kelpWorldLevel;
2001-04-25 20:15:19 +02:00
} sMapLevelData;
2001-07-25 18:20:01 +02:00
struct sMapLevelGfxTable
{
int Filename;
u8 *Gfx;
};
2001-08-03 01:44:21 +02:00
enum
{
MAP_ICON_PREVIOUS_CHAPTER,
MAP_ICON_LEVEL_1,
MAP_ICON_LEVEL_2,
MAP_ICON_LEVEL_3,
MAP_ICON_LEVEL_4,
MAP_ICON_LEVEL_BONUS,
MAP_ICON_NEXT_CHAPTER,
NUM_MAP_ICONS,
};
typedef struct
{
u8 m_left,m_right,m_up,m_down;
} sMapIconMoves;
typedef enum
{
CURSOR_DIDNT_MOVE,
CURSOR_MOVED,
CURSOR_COULDNT_MOVE,
} CURSOR_MOVE_STATE;
2001-05-31 23:17:33 +02:00
void renderPointer();
void renderInstructions();
2001-08-03 01:44:21 +02:00
void renderChapterArrows();
2001-05-31 23:17:33 +02:00
2001-04-25 20:15:19 +02:00
void generateMapScreenImage();
2001-04-24 21:37:12 +02:00
void copyImageToScreen(int _file,int _x,int _y,int _w,int _h);
2001-04-25 20:15:19 +02:00
DVECTOR getPointerTargetPosition();
2001-05-30 16:58:29 +02:00
int isLevelOpen(unsigned int _chapter,unsigned int _level);
2001-06-12 20:56:40 +02:00
int isChapterOpen(unsigned int _chapter);
2001-05-30 16:58:29 +02:00
int getSpatulaCollectedCount(unsigned int _chapter,unsigned int _level);
int hasQuestItemBeenCollected(unsigned int _chapter,unsigned int _level);
2001-04-24 21:37:12 +02:00
2001-04-24 18:15:04 +02:00
class FontBank *m_font;
int m_readyToExit;
2001-07-02 22:04:02 +02:00
int m_musicStarted;
2001-04-24 18:15:04 +02:00
2001-04-24 21:37:12 +02:00
char *m_screenImage;
2001-07-29 21:06:48 +02:00
char *m_packedBackgroundImage;
2001-04-24 21:37:12 +02:00
2001-04-25 01:14:50 +02:00
int m_currentChapterSelection;
2001-08-09 21:51:18 +02:00
int m_currentIconSelection;
2001-06-19 00:58:36 +02:00
class CPointerIcon *m_pointerIcon;
2001-04-25 01:14:50 +02:00
2001-07-25 18:20:01 +02:00
static sMapLevelGfxTable s_GfxTable[MAP_GFX_MAX];
static sMapLevelData s_mapLevelData[MAP_NUM_CHAPTERS][MAP_NUM_LEVELS_PER_CHAPTER];
static DVECTOR s_mapLevelPositions[MAP_NUM_LEVELS_PER_CHAPTER];
2001-08-09 21:51:18 +02:00
static DVECTOR s_mapPointerPositions[MAP_NUM_LEVELS_PER_CHAPTER+2];
static const int s_padToIconMappings[4][NUM_MAP_ICONS][NUM_MAP_ICONS];
2001-04-25 20:15:19 +02:00
2001-06-13 16:28:41 +02:00
static int s_chapterToStartOn;
static int s_levelToStartOn;
2001-04-24 18:15:04 +02:00
};
/*----------------------------------------------------------------------
Globals
------- */
extern CMapScene MapScene;
/*----------------------------------------------------------------------
Functions
--------- */
/*---------------------------------------------------------------------- */
#endif /* __MAP_MAP_H__ */
/*===========================================================================
end */