- [NEW] Triggers, pa enablar i disablar coses en calent

- [WIP] Treballant en el depth buffer
- [FIX] Ja canvia de sector com toca sempre
- [NEW] Ja pinta el cel
- [NEW] El minimap es pot activar i desactivar amb "M"
This commit is contained in:
2026-03-02 11:12:45 +01:00
parent 0ceeed7a6a
commit 681e27fad0
4 changed files with 139 additions and 126 deletions

View File

@@ -16,6 +16,7 @@ namespace draw
Uint32 *palette;
Uint8 screen[320*240];
float depth_buffer[320*240];
float clear_block[256];
void init()
{
@@ -26,11 +27,13 @@ namespace draw
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 240);
SDL_SetTextureScaleMode(sdl_texture, SDL_SCALEMODE_NEAREST);
debug::init(sdl_renderer);
for (int i=0;i<256;++i) clear_block[i] = 0;
}
void cls()
{
memset(screen, 0, 320*240);
int pos=0; for (int i=0;i<300;++i) { memcpy(&depth_buffer[pos], clear_block, 256); pos+=256; }
}
surface_t *newsurf(int w, int h)
@@ -85,8 +88,11 @@ namespace draw
void putpd(int x, int y, Uint8 color, float depth)
{
if (x<0 || y<0 || x>=320 || y>=240) return;
screen[x+y*320]=color;
depth_buffer[x+y*320]=depth;
//if (depth_buffer[x+y*320]<=depth)
//{
screen[x+y*320]=color;
depth_buffer[x+y*320]=depth;
//}
}
void putps(int x, int y, Uint8 color, float depth)