Subversion Repositories Games.Rick Dangerous

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * src/maps.h
  3.  *
  4.  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
  5.  *
  6.  * The use and distribution terms for this software are contained in the file
  7.  * named README, which can be found in the root of this distribution. By
  8.  * using this software in any fashion, you are agreeing to be bound by the
  9.  * terms of this license.
  10.  *
  11.  * You must not remove this notice, or any other, from this software.
  12.  */
  13.  
  14. #ifndef _MAPS_H
  15. #define _MAPS_H
  16.  
  17. #include "system.h"
  18.  
  19. #define MAP_NBR_MAPS 0x05
  20. #define MAP_NBR_SUBMAPS 0x2F
  21. #define MAP_NBR_CONNECT 0x99
  22. #define MAP_NBR_BNUMS 0x1FD8
  23. #define MAP_NBR_BLOCKS 0x0100
  24. #define MAP_NBR_MARKS 0x020B
  25. #define MAP_NBR_EFLGC 0x0020
  26.  
  27. /*
  28.  * map row definitions, for three zones : hidden top, screen, hidden bottom
  29.  * the three zones compose map_map, which contains the definition of the
  30.  * current portion of the submap.
  31.  */
  32. #define MAP_ROW_HTTOP 0x00
  33. #define MAP_ROW_HTBOT 0x07
  34. #define MAP_ROW_SCRTOP 0x08
  35. #define MAP_ROW_SCRBOT 0x1F
  36. #define MAP_ROW_HBTOP 0x20
  37. #define MAP_ROW_HBBOT 0x27
  38.  
  39. extern U8 map_map[0x2c][0x20];
  40.  
  41. /*
  42.  * main maps
  43.  */
  44. typedef struct
  45. {
  46.    U16 x, y;      /* initial position for rick */
  47.    U16 row;      /* initial map_map top row within the submap */
  48.    U16 submap;   /* initial submap */
  49.    char *tune;   /* map tune */
  50. } map_t;
  51.  
  52. extern map_t map_maps[MAP_NBR_MAPS];
  53.  
  54. /*
  55.  * sub maps
  56.  */
  57. typedef struct
  58. {
  59.    U16 page;                  /* tiles page */
  60.    U16 bnum;                  /* first block number */
  61.    U16 connect;             /* first connection */
  62.    U16 mark;                  /* first entity mark */
  63. } submap_t;
  64.  
  65. extern submap_t map_submaps[MAP_NBR_SUBMAPS];
  66.  
  67. /*
  68.  * connections
  69.  */
  70. typedef struct
  71. {
  72.    U8 dir;
  73.    U8 rowout;
  74.    U8 submap;
  75.    U8 rowin;
  76. } connect_t;
  77.  
  78. extern connect_t map_connect[MAP_NBR_CONNECT];
  79.  
  80. /*
  81.  * blocks - one block is 4 by 4 tiles.
  82.  */
  83. typedef U8 block_t[0x10];
  84.  
  85. extern block_t map_blocks[MAP_NBR_BLOCKS];
  86.  
  87. /*
  88.  * flags for map_marks[].ent ("yes" when set)
  89.  *
  90.  * MAP_MARK_NACT: this mark is not active anymore.
  91.  */
  92. #define MAP_MARK_NACT (0x80)
  93.  
  94. /*
  95.  * mark structure
  96.  */
  97. typedef struct
  98. {
  99.    U8 row;
  100.    U8 ent;
  101.    U8 flags;
  102.    U8 xy;   /* bits XXXX XYYY (from b03) with X->x, Y->y */
  103.    U8 lt;   /* bits XXXX XNNN (from b04) with X->trig_x, NNN->lat & trig_y */
  104. } mark_t;
  105.  
  106. extern mark_t map_marks[MAP_NBR_MARKS];
  107.  
  108. /*
  109.  * block numbers, i.e. array of rows of 8 blocks
  110.  */
  111. extern U8 map_bnums[MAP_NBR_BNUMS];
  112.  
  113. /*
  114.  * flags for map_eflg[map_map[row][col]]   ("yes" when set)
  115.  *
  116.  * MAP_EFLG_VERT: vertical move only (usually on top of _CLIMB).
  117.  * MAP_EFLG_SOLID: solid block, can't go through.
  118.  * MAP_EFLG_SPAD: super pad. can't go through, but sends entities to the sky.
  119.  * MAP_EFLG_WAYUP: solid block, can't go through except when going up.
  120.  * MAP_EFLG_FGND: foreground (hides entities).
  121.  * MAP_EFLG_LETHAL: lethal (kill entities).
  122.  * MAP_EFLG_CLIMB: entities can climb here.
  123.  * MAP_EFLG_01:
  124.  */
  125. #define MAP_EFLG_VERT (0x80)
  126. #define MAP_EFLG_SOLID (0x40)
  127. #define MAP_EFLG_SPAD (0x20)
  128. #define MAP_EFLG_WAYUP (0x10)
  129. #define MAP_EFLG_FGND (0x08)
  130. #define MAP_EFLG_LETHAL (0x04)
  131. #define MAP_EFLG_CLIMB (0x02)
  132. #define MAP_EFLG_01 (0x01)
  133.  
  134. extern U8 map_eflg_c[MAP_NBR_EFLGC];   /* compressed */
  135. extern U8 map_eflg[0x100];   /* current */
  136.  
  137. /*
  138.  * map_map top row within the submap
  139.  */
  140. extern U8 map_frow;
  141.  
  142. /*
  143.  * tiles offset
  144.  */
  145. extern U8 map_tilesBank;
  146.  
  147. extern void map_expand (void);
  148. extern void map_init (void);
  149. extern U8 map_chain (void);
  150. extern void map_resetMarks (void);
  151.  
  152. #endif
  153.