1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 #ifndef __ZCROLL16_H_
\r
24 #define __ZCROLL16_H_
\r
26 #include "src/lib/16_head.h"
\r
27 //#include "src/lib/bakapee.h"
\r
28 #include "src/lib/modex16.h"
\r
29 //#include "src/lib/16_in.h"
\r
30 #include "src/lib/bitmap.h"
\r
31 #include "src/lib/16_map.h" //map is loaded here www
\r
32 #include "src/lib/16_timer.h"
\r
33 #include "src/lib/wcpu/wcpu.h"
\r
35 #include <hw/cpu/cpu.h>
\r
36 #include <hw/dos/dos.h>
\r
37 #include <hw/vga/vga.h>
\r
38 #include <hw/vga/vrl.h>
\r
41 //#define TILERENDER
\r
43 //modexDrawSpritePBufRegion
\r
44 //modexDrawBmpPBufRegion
\r
45 #define PBUFSFUN modexDrawSpriteRegion
\r
46 #define PBUFBFUN modexDrawBmpRegion
\r
47 #define PLAYERBMPDATA player->data
\r
52 int tx; //appears to be the top left tile position on the viewable screen map
\r
53 int ty; //appears to be the top left tile position on the viewable screen map
\r
54 word dxThresh; //Threshold for physical tile switch
\r
55 word dyThresh; //Threshold for physical tile switch
\r
56 video_t *video; //pointer to game variables of the video
\r
57 pan_t *pan; //pointer the the page panning debug system
\r
63 enum direction {STOP, UP, DOWN, LEFT, RIGHT};
\r
65 word id; /* the Identification number of the page~ For layering~ */
\r
66 byte far* data; /* the data for the page */
\r
67 word sw; /* screen width */
\r
68 word sh; /* screen heigth */
\r
69 word tw; /* screen width in tiles */
\r
70 word th; /* screen height in tiles */
\r
71 word width; /* virtual width of the page */
\r
72 word height; /* virtual height of the page */
\r
73 word tilesw; /* virtual screen width in tiles */
\r
74 word tilesh; /* virtual screen height in tiles */
\r
75 sword tilemidposscreenx; /* middle tile position */
\r
76 sword tilemidposscreeny; /* middle tile position */
\r
77 sword tileplayerposscreenx; /* player position on screen */
\r
78 sword tileplayerposscreeny; /* player position on screen */
\r
79 word stridew; /*width/4*/
\r
80 word pagesize; /* page size */
\r
81 word pi; /* incremention page by this much to preserve location */
\r
82 word delta; // How much should we shift the page for smooth scrolling
\r
83 direction d; // Direction we should shift the page
\r
85 extern boolean pageflipflop, pageploop;
\r
86 extern unsigned char shinku_fps_indicator_page;
\r
88 /* Map is presumed to:
\r
89 * 1. Have all the required layers and tilesets within itself
\r
90 * 2. Have a 'fence' around accessible blocks to simplify boundary logic
\r
91 * 3. Have a persistent map and tile size among the layers
\r
92 * Map view is presumed to:
\r
93 * 1. Calculate, store and update a panning info, which includes, but not limited to:
\r
94 * combined layer information, actual map representation (reflecting real state of the game),
\r
95 * pixel shift for smooth tile scrolling.
\r
96 * 2. Provide ways to draw a visible part of map. For simplicity with smooth scrolling,
\r
97 * additional row/column is always drawn at the each side of the map. This implies that 'fence'
\r
98 * should have a sprite too. Map is drawn left-to-right, top-to-bottom.
\r
101 // Move an entity around. Should actually be in 16_entity
\r
102 boolean walk(entity_t *ent, map_view_t *map_v);
\r
104 // Move player around and call map scrolling if required/possible
\r
105 void walk_player(player_t *player, map_view_t *map_v);
\r
107 // Scroll map in one direction (assumed from player's movement)
\r
108 void near mapScroll(map_view_t *mv, player_t *player);
\r
109 sword chkmap(map_t *map, word q);
\r
110 void mapGoTo(map_view_t *mv, int tx, int ty);
\r
111 void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);
\r
113 void shinku(global_game_variables_t *gv);
\r
114 void near animatePlayer(map_view_t *pip, player_t *player, sword scrollswitch);
\r
116 #endif /*__ZCROLL16_H_*/
\r