CDecor
Header: include/decor.hpp (~642 lines)
Implementation: Split across 8 source files
CDecor is the central game engine class in Free Eggbert.
It manages the entire game world — the 100×100 tile grid, all moving objects,
the player character, game logic, rendering, save/load, networking, and the level editor.
Everything that "is the game" lives here.
Source File Responsibilities
| File | Responsibility | Status |
|---|---|---|
src/decor.cpp |
Initialization, world rendering, main step loop, region/music management | WIP |
src/decblupi.cpp |
Player movement, jumping, all vehicle logic, physics (4,395 lines) | WIP |
src/decblock.cpp |
Block/crate interaction, push/pull, door logic | WIP |
src/decmove.cpp |
Moving object (enemy/bomb/effect) step logic and AI | WIP |
src/decnet.cpp |
Network game synchronization and event dispatch | WIP |
src/decdesign.cpp |
Level editor — place/remove tiles and objects | WIP |
src/decio.cpp |
Save/load game state to/from .blp files | WIP |
src/dectables.cpp |
Static lookup tables for decor | Done |
Key Public Methods
Selected methods from include/decor.hpp (80+ methods total):
// Lifecycle
void Create(HWND hWnd, CSound*, CPixmap*, CNetwork*);
BOOL LoadImages();
void InitGamer();
void InitDecor();
void PlayPrepare(BOOL bTest);
void BuildPrepare();
// Game loop
int IsTerminated();
void MoveStep(); // advance world simulation by one tick
void Build(RECT rect); // render the visible world area
void SetInput(int keys); // feed key input (KEY_* bitmask)
int GetTime();
void SetTime(int time);
// World settings
int GetRegion();
void SetRegion(int region);
int GetMusic();
void SetMusic(int music);
POINT GetDim();
void SetDim(POINT dim);
BOOL GetPause();
void SetPause(BOOL bPause);
// Player state
int GetNbVies();
void SetNbVies(int nbVies);
void GetBlupiInfo(BOOL *pbHelico, BOOL *pbJeep, BOOL *pbSkate, BOOL *pbNage);
int GetBlupiChannelStandard();
int GetBlupiChannelActual();
int GetIconPerso();
// Cheats
BOOL GetSuperBlupi();
void SetSuperBlupi(BOOL bSuperBlupi);
BOOL GetDrawSecret();
void SetDrawSecret(BOOL bDrawSecret);
void CheatAction(int cheat);
// Save / load
BOOL Write(int gamer, int mission, BOOL bUser);
BOOL Read(int gamer, int mission, BOOL bUser);
BOOL CurrentWrite(int gamer, int mission, BOOL bUser=FALSE);
BOOL CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate);
BOOL MissionStart(int gamer, int mission, char* param3);
BOOL DeleteMission(int user, int mission, BOOL bUser);
// Doors and world
void SetAllMissions(BOOL bAllMissions);
void OpenDoorsTresor();
void OpenDoorsWin();
void OpenDoor(POINT cel);
// Network debug flags
BOOL GetNetPacked(); void SetNetPacked(BOOL);
BOOL GetNetMovePredict(); void SetNetMovePredict(BOOL);
BOOL GetNetDebug(); void SetNetDebug(BOOL);
void SetMulti(BOOL bMulti);
void SetTeam(int team);
// Audio (delegates to CSound)
void PlaySound(int sound, POINT pos, BOOL bLocal);
void StopSound(int sound);
// Moving objects
BOOL ObjectStart(POINT pos, int type, int speed, BOOL bMulti);
BOOL ObjectDelete(POINT pos, int type, BOOL bMulti=TRUE);
void MoveObjectStep();
// World tile helpers
BOOL IsLave(POINT pos); // lava
BOOL IsPiege(POINT pos); // trap
BOOL IsGoutte(POINT pos, BOOL bAlways); // drip
BOOL IsScie(POINT pos); // saw
BOOL IsSwitch(POINT pos, POINT *outCelSwitch);
BOOL IsBlitz(POINT pos, BOOL bAlways); // lightning
BOOL IsDeepWater(POINT pos);
BOOL IsSurfWater(POINT pos);
Player State Model
Unlike the Planet Blupi engine which uses a Blupi[100] array for up to 100
simultaneous characters, Free Eggbert stores the player state as individual member
fields directly in CDecor:
| Field Pattern | Description |
|---|---|
m_blupiPos | Current position in world |
m_blupiAction | Current animation/action state (ACTION_*) |
m_blupiDir | Facing direction |
m_blupiTransport | Current vehicle (0=none, 1=helicopter, 2=jeep, 3=tank) |
m_blupiShield, m_blupiPower, etc. | Active power-up states |
In multiplayer, up to 4 players are tracked through the NetPacket stream;
each player sends their own position and state each game tick.
Moving Object System
The moveObject[200] array (type MoveObject[MAXMOVEOBJECT])
tracks all active enemies, bombs, vehicles, collectibles, and effects in the level.
This array is managed primarily in src/decmove.cpp.
See Object Types Reference for all TYPE_* values.
Save/Load
src/decio.cpp serializes the complete game state — including the world grid,
all moving objects, and player status — into a DescSave struct (~56KB).
Up to 6 save slots are supported.
DescSave layout has changed.
Level Editor
src/decdesign.cpp implements the built-in level editor.
Activated via WM_PHASE_BUILD.