2020-11-06 14:56:32 +01:00
|
|
|
#pragma once
|
2020-11-08 16:37:59 +01:00
|
|
|
#include "gdrv.h"
|
|
|
|
#include "maths.h"
|
|
|
|
#include "zdrv.h"
|
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
enum class VisualTypes : char
|
2020-11-08 16:37:59 +01:00
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
Sprite = 1,
|
|
|
|
Ball = 2
|
|
|
|
};
|
|
|
|
|
2021-01-29 14:42:05 +01:00
|
|
|
struct render_sprite_type_struct
|
2020-11-08 16:37:59 +01:00
|
|
|
{
|
2020-11-15 15:39:00 +01:00
|
|
|
rectangle_type BmpRect;
|
|
|
|
gdrv_bitmap8* Bmp;
|
2020-11-08 16:37:59 +01:00
|
|
|
zmap_header_type* ZMap;
|
2020-12-27 16:19:36 +01:00
|
|
|
char UnknownFlag;
|
2021-09-09 10:40:54 +02:00
|
|
|
VisualTypes VisualType;
|
2021-02-16 17:03:45 +01:00
|
|
|
int16_t Depth;
|
2021-09-25 15:52:19 +02:00
|
|
|
rectangle_type DirtyRectPrev;
|
2020-11-08 16:37:59 +01:00
|
|
|
int ZMapOffestY;
|
|
|
|
int ZMapOffestX;
|
2020-11-15 15:39:00 +01:00
|
|
|
rectangle_type DirtyRect;
|
2021-10-02 16:45:31 +02:00
|
|
|
std::vector<render_sprite_type_struct*>* SpriteArray;
|
2020-11-15 15:39:00 +01:00
|
|
|
rectangle_type BoundingRect;
|
2020-11-08 16:37:59 +01:00
|
|
|
};
|
|
|
|
|
2020-11-15 15:39:00 +01:00
|
|
|
|
2020-11-06 14:56:32 +01:00
|
|
|
class render
|
|
|
|
{
|
|
|
|
public:
|
2021-10-02 16:45:31 +02:00
|
|
|
static gdrv_bitmap8 *vscreen, *background_bitmap;
|
2021-09-25 15:52:19 +02:00
|
|
|
static SDL_Rect DestinationRect;
|
2020-11-08 16:37:59 +01:00
|
|
|
|
2020-11-15 15:39:00 +01:00
|
|
|
static void init(gdrv_bitmap8* bmp, float zMin, float zScaler, int width, int height);
|
|
|
|
static void uninit();
|
2021-10-25 05:42:36 +02:00
|
|
|
static void recreate_screen_texture();
|
2020-11-06 14:56:32 +01:00
|
|
|
static void update();
|
2020-11-15 15:39:00 +01:00
|
|
|
static void sprite_modified(render_sprite_type_struct* sprite);
|
2021-09-09 10:40:54 +02:00
|
|
|
static render_sprite_type_struct* create_sprite(VisualTypes visualType, gdrv_bitmap8* bmp,
|
2020-11-08 16:37:59 +01:00
|
|
|
zmap_header_type* zMap,
|
2020-11-15 15:39:00 +01:00
|
|
|
int xPosition, int yPosition, rectangle_type* rect);
|
2021-10-02 16:45:31 +02:00
|
|
|
static void remove_sprite(render_sprite_type_struct* sprite, bool removeFromList);
|
|
|
|
static void remove_ball(render_sprite_type_struct* ball, bool removeFromList);
|
2020-11-15 15:39:00 +01:00
|
|
|
static void sprite_set(render_sprite_type_struct* sprite, gdrv_bitmap8* bmp, zmap_header_type* zMap, int xPos,
|
|
|
|
int yPos);
|
|
|
|
static void sprite_set_bitmap(render_sprite_type_struct* sprite, gdrv_bitmap8* bmp);
|
|
|
|
static void set_background_zmap(struct zmap_header_type* zMap, int offsetX, int offsetY);
|
2021-10-02 16:45:31 +02:00
|
|
|
static void ball_set(render_sprite_type_struct* sprite, gdrv_bitmap8* bmp, float depth, int xPos, int yPos);
|
2021-09-25 15:52:19 +02:00
|
|
|
static void shift(int offsetX, int offsetY);
|
|
|
|
static void build_occlude_list();
|
|
|
|
static void SpriteViewer(bool* show);
|
|
|
|
static void PresentVScreen();
|
|
|
|
private:
|
2021-10-02 16:45:31 +02:00
|
|
|
static std::vector<render_sprite_type_struct*> dirty_list, sprite_list, ball_list;
|
2021-09-25 15:52:19 +02:00
|
|
|
static zmap_header_type* background_zmap;
|
|
|
|
static int zmap_offset, zmap_offsetY, offset_x, offset_y;
|
|
|
|
static float zscaler, zmin, zmax;
|
|
|
|
static rectangle_type vscreen_rect;
|
2021-10-02 16:45:31 +02:00
|
|
|
static gdrv_bitmap8 *ball_bitmap[20];
|
|
|
|
static zmap_header_type* zscreen;
|
2021-09-25 15:52:19 +02:00
|
|
|
|
2020-11-15 15:39:00 +01:00
|
|
|
static void repaint(struct render_sprite_type_struct* sprite);
|
|
|
|
static void paint_balls();
|
|
|
|
static void unpaint_balls();
|
2020-11-06 14:56:32 +01:00
|
|
|
};
|