; ============================================================================== ; EBLAN ENGINE - Global State and Data Structures ; ============================================================================== .data ; Window and GDI szClassName db "EblanEngine3DWndClass",0 szWindowTitle db "EBLAN ENGINE 3D - Retro Raycaster [Pure x86 Assembly]",0 hEngineWnd dd 0 hEngineDC dd 0 hEngineInstance dd 0 isRunning dd 1 ; High Precision Timing targetFrameTimeMs dd 16 ; ~60 FPS (16.6 ms) lastTickCount dd 0 fpsCounter dd 0 fpsTimer dd 0 currentFps dd 60 szFpsLabel db "FPS: ",0 ; Software Framebuffer & BITMAPINFO ALIGN 4 bmiEngine BITMAPINFOHEADER dd 0 ; palette dummy rngSeed dd 12345678h ; Player State ; Position in RAW world units (1 cell = 64 units; e.g. 160 = cell 2.5) playerX dd 160 playerY dd 160 playerAngle dd 0 ; 0..511 (0 = East, 128 = South, 256 = West, 384 = North) playerMoveSpeed dd 3 ; raw units per frame (walk) playerRunSpeed dd 6 ; raw units per frame (sprint) playerTurnSpeed dd 4 ; angle units per frame playerRadius dd 16 ; collision radius (raw units) ; Input State Flags keyForward db 0 keyBackward db 0 keyStrafeLeft db 0 keyStrafeRight db 0 keyTurnLeft db 0 keyTurnRight db 0 keyAction db 0 keyRun db 0 keyShowMap db 1 ; minimap toggle keyScreenshot db 0 ; F12 screenshot request ; Map palette (overridable by map.dat header) mapCeilingColor dd COLOR_CEILING mapFloorColor dd COLOR_FLOOR szMapFilePath db "assets\map.dat",0 ; Texture pack (optional; falls back to procedural textures) szTexPackPath db "assets\textures\texturepack.bin",0 texPackLoaded dd 0 ; Sprite Manager spriteCount dd 0 ; Engine HUD & Strings strControls1 db "WASD: Move / Strafe | Shift: Run",0 strControls2 db "Arrows: Turn Camera",0 strControls3 db "E: Door | M: Minimap | F12: Shot | Esc: Exit",0 strEngineName db "EBLAN ENGINE 3D (x86 MASM)",0 strDoorHint db "[E] - Door",0 ; Screenshot (F12): writes 32-bit top-down BMP of screenBuffer szScreenshotPath db "screenshot.bmp",0 ALIGN 4 screenshotHeader db 'B','M' dd (54 + FRAME_BUFFER_SIZE) ; bfSize dd 0 ; bfReserved dd 54 ; bfOffBits dd 40 ; BITMAPINFOHEADER.biSize dd SCREEN_W ; biWidth dd -SCREEN_H ; biHeight (top-down) dw 1 ; biPlanes dw 32 ; biBitCount dd 0 ; biCompression = BI_RGB dd FRAME_BUFFER_SIZE ; biSizeImage dd 0, 0, 0, 0 ; ------------------------------------------------------------------------------ ; Large buffers live in BSS (.data?) so they are NOT baked into the .exe ; ------------------------------------------------------------------------------ .data? ALIGN 4 screenBuffer db FRAME_BUFFER_SIZE dup(?) ALIGN 4 depthBuffer dd SCREEN_W dup(?) ; Fixed-point Math Lookup Tables (512 angles, 16.16 signed fixed point) ALIGN 4 tableSin dd ANGLE_512 dup(?) tableCos dd ANGLE_512 dup(?) ; Game Map Grid (32x32 = 1024 bytes) gameMap db MAP_SIZE dup(?) ; Texture Memory (16 slots of 128x128 32-bit BGRA = 1 MB) ALIGN 4 textureBuffer db MAX_TEXTURES * TEX_SIZE_BYTES dup(?) ALIGN 4 spriteList db MAX_SPRITES * (sizeof SpriteStruct) dup(?) spriteOrder dd MAX_SPRITES dup(?) ; sprite indices sorted far-to-near