1 /* Keen Dreams Source Code
\r
2 * Copyright (C) 2014 Javier M. Chavez
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along
\r
15 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 #include "src/lib/16_mm.h"
\r
28 =============================================================================
\r
32 =============================================================================
\r
38 #define MAPBORDER 2 // map border must be at least 1
\r
40 #define MAXSPRITES 100 // max tracked sprites
\r
41 #define MAXANIMTILES 90 // max animating tiles on screen
\r
42 #define MAXANIMTYPES 50 // max different unique anim tiles on map
\r
44 #define MAXMAPHEIGHT 128
\r
46 #define PRIORITIES 4
\r
47 #define MASKEDTILEPRIORITY 3 // planes go: 0,1,2,MTILES,3
\r
49 #define TILEGLOBAL 256
\r
50 #define PIXGLOBAL 16
\r
52 #define G_T_SHIFT 8 // global >> ?? = tile
\r
53 #define G_P_SHIFT 4 // global >> ?? = pixels
\r
54 #define P_T_SHIFT 4 // pixels >> ?? = tile
\r
56 #define PORTTILESWIDE 21 // all drawing takes place inside a
\r
57 #define PORTTILESHIGH 14 // non displayed port of this size
\r
59 //#define PORTGLOBALWIDE (21*TILEGLOBAL)
\r
60 //#define PORTGLOBALHIGH (14*TILEGLOBAL)
\r
62 #define UPDATEWIDE (PORTTILESWIDE+1)
\r
63 #define UPDATEHIGH PORTTILESHIGH
\r
66 #define SCREENWIDTH 64
\r
67 #define NUMTILE16 1440
\r
68 #define STARTTILE16 370
\r
69 #define STARTTILE16M 1810
\r
70 #define NUMTILE16M 1206
\r
72 #define ANIM (SPEED+NUMTILE16)
\r
75 #define NORTHWALL (ANIM+NUMTILE16)
\r
76 #define EASTWALL (NORTHWALL+NUMTILE16M)
\r
77 #define SOUTHWALL (EASTWALL+NUMTILE16M)
\r
78 #define WESTWALL (SOUTHWALL+NUMTILE16M)
\r
79 #define MANIM (WESTWALL+NUMTILE16M)
\r
80 #define INTILE (MANIM+NUMTILE16M)
\r
81 #define MSPEED (INTILE+NUMTILE16M)
\r
84 //#define MAXSHIFTS 1
\r
85 #define TILEWIDTH TILEWH
\r
86 typedef enum {NOcard,MDAcard,CGAcard,EGAcard,MCGAcard,VGAcard,
\r
87 HGCcard=0x80,HGCPcard,HICcard} cardtype;
\r
88 typedef enum {CGAgr,EGAgr,VGAgr} grtype;
\r
100 unsigned sourceoffset[MAXSHIFTS];
\r
101 unsigned planesize[MAXSHIFTS];
\r
102 unsigned width[MAXSHIFTS];
\r
104 } spritetype; // the memptr for each sprite points to this*/
\r
107 //===========================================================================
\r
109 typedef enum {spritedraw,maskdraw} drawtype;
\r
112 =============================================================================
\r
116 =============================================================================
\r
120 extern boolean compatability; // crippled refresh for wierdo SVGAs
\r
122 extern unsigned tics;
\r
123 extern long lasttimecount;
\r
125 extern unsigned originxglobal,originyglobal;
\r
126 extern unsigned originxtile,originytile;
\r
127 extern unsigned originxscreen,originyscreen;
\r
129 extern unsigned mapwidth,mapheight,mapbyteswide,mapwordswide
\r
130 ,mapbytesextra,mapwordsextra;
\r
131 extern unsigned mapbwidthtable[MAXMAPHEIGHT];
\r
133 extern unsigned originxmin,originxmax,originymin,originymax;
\r
135 extern unsigned masterofs;
\r
138 // the floating update window is also used by the view manager for
\r
139 // double buffer tracking
\r
142 extern byte *updateptr; // current start of update window
\r
144 #if GRMODE == CGAGR
\r
145 extern byte *baseupdateptr;
\r
148 extern unsigned blockstarts[UPDATEWIDE*UPDATEHIGH];
\r
149 extern unsigned updatemapofs[UPDATEWIDE*UPDATEHIGH];
\r
150 extern unsigned uwidthtable[UPDATEHIGH]; // lookup instead of multiple
\r
152 #define UPDATETERMINATE 0x0301
\r
155 =============================================================================
\r
159 =============================================================================
\r
162 void RF_Startup (void);
\r
163 void RF_Shutdown (void);
\r
165 void RF_NewMap (void);
\r
166 void RF_MarkTileGraphics (void);
\r
167 void RF_NewPosition (unsigned x, unsigned y);
\r
168 void RF_Scroll (int x, int y);
\r
170 void RF_PlaceSprite (void **user,unsigned globalx,unsigned globaly,
\r
171 unsigned spritenumber, drawtype draw, int priority);
\r
172 void RF_RemoveSprite (void **user);
\r
174 void RF_Refresh (void);
\r
175 void RF_ForceRefresh (void);
\r
176 void RF_SetRefreshHook (void (*func) (void) );
\r