diff -r 000000000000 -r b2e3aa63e96c src/common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/common.h Thu Jul 17 22:03:19 2025 -0400 @@ -0,0 +1,120 @@ +/* +Copyright (c) 2023 MCL Software +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +#ifndef COMMON +#define COMMON + +#define TILEMAP_DIMS 16 + +#include +#include +#include "fontcche.h" +#include +#include + +#define SCREEN_WIDTH 1280 +#define SCREEN_HEIGHT 960 + +// Level width and height in tiles +#define LEVEL_WIDTH 256 // X +#define LEVEL_HEIGHT 5 // Y +#define LEVEL_DEPTH 256 // Z + +// Tile width and height in pixels +#define TILE_WIDTH 89 +#define TILE_HEIGHT 90 + +extern SDL_Texture* logo; +extern bool gameRunning; +extern int zoomFactor; +extern int orientation; +extern int stealProgress; +extern bool fireAlarmSystemActivated; +extern SDL_TimerID fireAlarmTimer; +extern Mix_Chunk* alarmSound; +extern Mix_Music* themeSong; +extern Mix_Music* bgm1; +extern Mix_Music* bgm2; +extern Mix_Music* bgm3; +extern Mix_Music* bgm4; +extern Mix_Music* bgm5; +extern Mix_Music* bgm6; +extern Mix_Music* bgm7; +extern Mix_Music* bgm8; +extern Mix_Music* bgm9; +extern Mix_Music* bgm10; +extern Mix_Music* bgm11; +extern Mix_Music* bgm12; +extern Mix_Music* bgm13; +extern Mix_Music* bgm14; +extern int selectedMenuItem; + +extern FC_Font* font; + +typedef struct +{ + int x, y; + char objectsStolen[8]; + bool canMove; + bool canLeaveCampus; + bool leftCampus; +} +Player; + +typedef struct +{ + int ident; +} +Interactions; + +typedef struct +{ + int textureIndex; + bool passable; + int stealable; + int stealTime; + int interactable; // Different numbers mean different actions (e.g. 0 = sit in chair, 1 = activate fire alarm sys, 2 = flush toilet, etc.) + int placementHeight; + int height; + int textureHeight; + bool renderUnder; + bool renderAbove; + bool flipTexture; +} +Object; + +typedef struct +{ + Object level[LEVEL_WIDTH * LEVEL_HEIGHT * LEVEL_DEPTH]; +} +Level; + +Object getObjectFromIdent(char ident); + +SDL_Point getTransformation(int x, int y); + +SDL_Point getLevelTransformation(int i, int j); + +SDL_Point pixelToTileCoordinates(int x, int y); + +SDL_Point tileToPixelCoordinates(int x, int y); + +extern char levelTiles[LEVEL_WIDTH * LEVEL_DEPTH]; + +extern Player player; +extern SDL_Point offset; +extern SDL_Rect clip; +extern SDL_Rect destRect; +extern SDL_Renderer* renderer; +extern SDL_Texture* tilemap; +extern SDL_Surface* tilemapSurface; +extern double frameDelta; + +#endif