pasada la granera per la carpeta
This commit is contained in:
1 parent
6474d731d0
commit
9e0ab87c76
42 files changed
+128
-37
No files matched your search
+2
-4
@@ -1,8 +1,6 @@
|
||||
syntax: glob
|
||||
|
||||
aee
|
||||
.DS_Store
|
||||
trick.ini
|
||||
.vscode/*
|
||||
.vscode/
|
||||
data.jrf
|
||||
build/*
|
||||
build/
|
||||
@@ -0,0 +1,60 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
**Aventures En Egipte (AEE)** — a retro-style 2D game written in C++ using SDL3. The game uses a software-rendered 8-bit paletted graphics engine (320x200, 256 colors) with an OpenGL CRT shader pass, custom audio (JailAudio replacing SDL_Mixer), and GIF-based assets. The codebase and commit messages are in Valencian/Catalan.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
# Linux
|
||||
cmake -B build
|
||||
cmake --build build
|
||||
|
||||
# Windows (MinGW)
|
||||
cmake -B build -G "MinGW Makefiles"
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Dependencies: SDL3, OpenGL. Uses CMake (minimum 3.10) with C++20.
|
||||
|
||||
The executable is output to the project root. The `data/` folder contains runtime assets (GIF images, OGG music, GLSL shader) and must be in the working directory at runtime.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Custom "Jail" Engine Libraries (prefix: J)
|
||||
|
||||
All engine modules are flat C-style APIs (no classes), prefixed by subsystem:
|
||||
|
||||
- **JG** (`source/jgame`) — Game loop timing: init/finalize, fixed-timestep update via `JG_ShouldUpdate()`
|
||||
- **JD8** (`source/jdraw8`) — 8-bit paletted software renderer. 320x200 screen buffer (`JD8_Surface` = `Uint8*`), palette-indexed blitting with color-key transparency, fade effects. `JD8_Flip()` converts the indexed buffer to ARGB, uploads to SDL texture, and renders through the CRT shader
|
||||
- **JA** (`source/jail_audio`) — Custom audio mixing using SDL3 audio streams directly (OGG via stb_vorbis, WAV). Manages music and sound channels independently
|
||||
- **JI** (`source/jinput`) — Input: keyboard state polling, key debouncing, cheat code detection
|
||||
- **JF** (`source/jfile`) — File I/O: supports loading from filesystem folder or a packed resource file (`.jrf`). Currently uses folder mode (`data/`)
|
||||
- **shader** (`source/jshader`) — OpenGL post-processing shader (CRT effect) applied to the back buffer
|
||||
|
||||
### Game Modules
|
||||
|
||||
- **ModuleSequence** (`modulesequence.cpp/h`) — Non-gameplay screens: intro, menu, slides, banners, credits, death screen. State machine entry point (state=1)
|
||||
- **ModuleGame** (`modulegame.cpp/h`) — Core gameplay loop. Owns and orchestrates all game objects. State=0
|
||||
- **Sprite** (`sprite.cpp/h`) — Base class for animated entities (frame/animation data via `Entitat`)
|
||||
- **Prota** (`prota.cpp/h`) — Player character ("Sam"), extends Sprite
|
||||
- **Mapa** (`mapa.cpp/h`) — Level map with tomb grid (16 tombs), items (treasure, keys, pharaoh, mummy, scroll, diamond), door logic
|
||||
- **Momia** (`momia.cpp/h`) — Enemy: mummies
|
||||
- **Bola** (`bola.cpp/h`) — Enemy: projectile ball
|
||||
- **Marcador** (`marcador.cpp/h`) — HUD/scoreboard
|
||||
- **info** (`info.cpp/h`) — Global game state namespace (room number, pyramid, money, diamonds, lives, etc.)
|
||||
|
||||
### Main Loop (`main.cpp`)
|
||||
|
||||
A state machine alternates between `ModuleSequence` (state 1) and `ModuleGame` (state 0). Each module's `Go()` returns the next state (-1 to quit). Modules are allocated/freed each transition.
|
||||
|
||||
### Key Conventions
|
||||
|
||||
- All surfaces are 320x200 = 64000 bytes. Pixel coordinates assume this fixed resolution
|
||||
- Graphics loaded from GIF files, palettes extracted from GIF headers
|
||||
- Music files are numbered OGG files (`00000001.ogg` etc.)
|
||||
- `trick.ini` presence enables the secret character
|
||||
- The `gif.h` is a header-only GIF decoder; `stb_vorbis.h` is the stb single-header OGG decoder
|
||||
@@ -0,0 +1,62 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(aee VERSION 1.00)
|
||||
|
||||
# Estándar de C++
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Exportar comandos de compilación para herramientas de análisis
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# --- LISTA EXPLÍCITA DE FUENTES ---
|
||||
set(APP_SOURCES
|
||||
source/main.cpp
|
||||
source/bola.cpp
|
||||
source/engendro.cpp
|
||||
source/info.cpp
|
||||
source/jail_audio.cpp
|
||||
source/jdraw8.cpp
|
||||
source/jfile.cpp
|
||||
source/jgame.cpp
|
||||
source/jinput.cpp
|
||||
source/jshader.cpp
|
||||
source/mapa.cpp
|
||||
source/marcador.cpp
|
||||
source/modulegame.cpp
|
||||
source/modulesequence.cpp
|
||||
source/momia.cpp
|
||||
source/prota.cpp
|
||||
source/sprite.cpp
|
||||
)
|
||||
|
||||
# Configuración de SDL3
|
||||
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
|
||||
message(STATUS "SDL3 encontrado: ${SDL3_INCLUDE_DIRS}")
|
||||
|
||||
# --- EJECUTABLE ---
|
||||
add_executable(${PROJECT_NAME} ${APP_SOURCES})
|
||||
|
||||
# --- DIRECTORIOS DE INCLUSIÓN ---
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/source"
|
||||
)
|
||||
|
||||
# Enlazar SDL3
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3)
|
||||
|
||||
# --- FLAGS DE COMPILACIÓN ---
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:RELEASE>:-Os -ffunction-sections -fdata-sections>)
|
||||
|
||||
# --- CONFIGURACIÓN POR PLATAFORMA ---
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE mingw32 opengl32)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL)
|
||||
endif()
|
||||
|
||||
# Ejecutable en la raíz del proyecto
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
/opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc -D GCWZERO -O2 -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL2 -D_GNU_SOURCE=1 -D_REENTRANT -lSDL2 -lSDL2_mixer -lstdc++ *.cpp -o aee
|
||||
|
||||
/opt/gcw0-toolchain/usr/bin/mksquashfs ./default.gcw0.desktop ./icon.png ./aee ./data.jrf aee.opk -all-root -noappend -no-exports -no-xattrs
|
||||
|
||||
ftp -n -v 10.1.1.2 << EOT
|
||||
ascii
|
||||
user root ezahfm
|
||||
pass
|
||||
cd apps
|
||||
put ./aee.opk
|
||||
bye
|
||||
EOT
|
||||
@@ -1,5 +0,0 @@
|
||||
libs = -lSDL3 -lGL
|
||||
cppflags = -D DEBUG -D VERBOSE -g -Wall
|
||||
executable = aee
|
||||
sourcepath = .
|
||||
buildpath = build
|
||||
@@ -1,10 +0,0 @@
|
||||
TARGET=aee
|
||||
linux:
|
||||
g++ *.cpp -lSDL3 -lGL -o $(TARGET)
|
||||
|
||||
windows:
|
||||
g++ *.cpp -lmingw32 -lSDL3 -lopengl32 -mwindows -o $(TARGET)
|
||||
|
||||
clean:
|
||||
rm -rf ./$(TARGET)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -69,7 +69,7 @@ bool file_getdictionary() {
|
||||
fi.read((char*)&toc_offset, 4);
|
||||
fi.seekg(toc_offset);
|
||||
|
||||
for (int i=0; i<num_files; ++i)
|
||||
for (uint32_t i=0; i<num_files; ++i)
|
||||
{
|
||||
uint32_t file_offset, file_size;
|
||||
fi.read( (char*)&file_offset, 4 );
|
||||
@@ -83,6 +83,7 @@ bool file_getdictionary() {
|
||||
toc.push_back({filename, file_size, file_offset});
|
||||
}
|
||||
fi.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
char *file_getfilenamewithfolder(const char* filename) {
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
#include "jgame.h"
|
||||
|
||||
bool eixir = false;
|
||||
int updateTicks = 0;
|
||||
Uint32 updateTicks = 0;
|
||||
Uint32 updateTime = 0;
|
||||
Uint32 cycle_counter = 0;
|
||||
|
||||
File renamed without changes.
@@ -41,7 +41,7 @@ bool JI_KeyPressed(int key) {
|
||||
|
||||
bool JI_CheatActivated( const char* cheat_code ) {
|
||||
bool found = true;
|
||||
for( int i = 0; i < strlen( cheat_code ); i++ ) {
|
||||
for( size_t i = 0; i < strlen( cheat_code ); i++ ) {
|
||||
if( cheat[i] != cheat_code[i] ) found = false;
|
||||
}
|
||||
return found;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -862,7 +862,6 @@ void ModuleSequence::doCredits() {
|
||||
int contador = 0;
|
||||
|
||||
bool exit = false;
|
||||
int step = 0;
|
||||
contador = 1;
|
||||
while (!exit && !JG_Quitting()) {
|
||||
if (JG_ShouldUpdate()) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user