heh
This commit is contained in:
parent
6640b9d402
commit
517395d500
152
README.md
152
README.md
|
@ -1,152 +0,0 @@
|
|||
# --| Controls |--
|
||||
- in-game:
|
||||
**WASD/ZQSD** (depends on keyboard, usually WASD) - movement
|
||||
**QE/AE** (depends on keyboard, usually QE)- horizontal camera rotation
|
||||
**PM** - vertical camera rotation
|
||||
**ESC** - exit application
|
||||
|
||||
- creative tools:
|
||||
**Y** select level destination
|
||||
**R** warp to targetted level (resets player's position)
|
||||
**T** warp to targetted level (no update top player's position)
|
||||
|
||||
- while in menus:
|
||||
<!> when editing a value : **A** (add), **S** (subtract), **M** (multiply), **D** (divide), **ENTER/SPACE** (proceed)
|
||||
|
||||
# --| Mods (in case you find it easy) |--
|
||||
|
||||
*Hidden* (HD) : makes the terrain blink to be totally invisible sometimes
|
||||
*HardRock* (HR) : multiplies damage taken, enables fall damage and kills you upon falling into the void
|
||||
*DoubleTime* (DT) : makes everything faster
|
||||
*SuddenDeath* (SD) : sets your HP at 1 and disables healing
|
||||
*Flashlight* (FL) : drastically lowers your view distance
|
||||
*Speedy* (SP) : makes you lose HP over time
|
||||
*Flip* (FP) : flips the screen over the Y axis, inverting some directions
|
||||
|
||||
# --| Syntax for level files |--
|
||||
|
||||
1) **General rules**
|
||||
. each file must be named "room_k" where k is a positive integer
|
||||
if "room_k" exists then all "room_u" where 0 <= u < k exists
|
||||
|
||||
. you can add text at the end of each line as comments
|
||||
but *do not use caps*, *this might confuse the parser*
|
||||
|
||||
. at the end of each file, the weight of the room is required (can be any positive integer)
|
||||
if **there is only one file (==> its name is room_0) AND weight is 0**, the room will only generate at the central chunk (any other will be NULL)
|
||||
use this if you want to create parkour levels, puzzles...
|
||||
else, **make sure the total weight (the sum of all) is not equal to 0** *(you may end up with a floating point exception)*
|
||||
|
||||
. no matter what, room_0 will **always** generate at chunk (0, 0)
|
||||
|
||||
2) **Data structure**
|
||||
below is a detailled list for all block types ;
|
||||
each block type (Blocks, Teleporters, Entities) must have the corresponding word directly above it
|
||||
not all three keywords have to be written
|
||||
|
||||
[] is mandatory data
|
||||
{} is optionnal data
|
||||
|
||||
*Data-specific structure :*
|
||||
```
|
||||
blocks:
|
||||
[x, y, z, w, h, d, rhz, rvt, r, g, b]
|
||||
|
||||
teleporters:
|
||||
[x, y, z, w, h, d, rhz, rvt, r, g, b, dest_chx, dest_chy]
|
||||
|
||||
entities:
|
||||
[x, y, z, w, h, d, rhz, rvt, r, g, b, hp, damage, entityType ..]
|
||||
|
||||
|
||||
|> if entityType >= 4, use 1 for HP and 0 for damage <|
|
||||
|> *Entity types are :* <|
|
||||
|
||||
-> 0 (coin) -> HP equals the coin's value
|
||||
-> 1 (non-moving explosive)
|
||||
-> 2 (damaging firebar/spinning platform (set damage to 0))
|
||||
[.. hz_rps, vt_rps, x_offset, y_offset, z_offset, dps] with
|
||||
{hz,vt}_rps = double
|
||||
hz0, vt_0 = double
|
||||
{x,y,z}_offset = double // if all is 0.0, the solid will rotate according to its center of mass, this shifts that center
|
||||
dps = int[>0]
|
||||
|
||||
-> 3 (shooting (towards player), maybe moving explosive)
|
||||
[.. proj_speed, shoot_speed, shot_freq, shot_ttl] with
|
||||
{all} = double[>= 0.0]
|
||||
|
||||
-> 4 (moving platform)
|
||||
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase, {initialState, triggerButton}] with
|
||||
amplitude_{x,y,z} = double[>= 0.0]
|
||||
{mult,divd} = int
|
||||
{phase} = int[0, 360]
|
||||
{..} = int(>=0)
|
||||
|
||||
-> 5 (linear moving platform)
|
||||
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z, {initialState, triggerButton}] with
|
||||
amplitude_{x,y,z} = double[>= 0.0]
|
||||
speed_{x,y,z} = double
|
||||
{..} = int(>=0)
|
||||
|
||||
-> 6 (text box)
|
||||
[.. text, tred, tgreen, tblue] with
|
||||
text = {char*}
|
||||
|
||||
-> 7 (warp text box)
|
||||
[.. dest_folder, room_count, text, tred, tgreen, tblue] with
|
||||
{dest_folder,text} = {char*} (length <= 50)
|
||||
{r,g,b} = int[0-256]
|
||||
|
||||
|
||||
-> 8 (lock box)
|
||||
[.. cost, doPay, tred, tgreen, tblue] with
|
||||
cost = int[> 0] (0 breaks)
|
||||
doPay = {0, 1} (bool)
|
||||
|
||||
-> 9 (beat block)
|
||||
[.. ontime, offtime, start] with
|
||||
{ontime,offtime} = double[>0.0]
|
||||
start = {0,1}
|
||||
|
||||
-> 10 (movable block)
|
||||
[.. friction, mass] with
|
||||
friction = double[>0.0]
|
||||
mass = double[>0.0] (in kg)
|
||||
|
||||
-> 11 (button trigger)
|
||||
[.. freq, dtime] with
|
||||
freq = int[0 - 15]
|
||||
dtime = double([>0.0] for time-limited press, or use -1.0 if no deactivation)
|
||||
|
||||
-> 12 (button block)
|
||||
[.. freq, defaultState] with
|
||||
freq = int[0 - 15]
|
||||
defaultState = {0, 1}
|
||||
|
||||
-> 13 (math block)
|
||||
[.. defaultState, timeOff] with
|
||||
defaultState = {0, 1}
|
||||
dtime = double([>0.0] for time-limited press, or use -1.0 if no deactivation)
|
||||
|
||||
-> 14 (movable object-related button)
|
||||
[.. freq] with
|
||||
freq = int[0 - 15]
|
||||
|
||||
-> 15 (gun)
|
||||
[.. vx, vy, vz, ax, ay, az, cooldown, phase, ttl, dmg, psize_x, psize_y, psize_z] with
|
||||
all\{dmg} = double (cooldown > 0.0 and ttl > 0.0 and psize_{x,y,z} > 0.0)
|
||||
dmg = int (>0)
|
||||
|
||||
-> 16 (type 1 entity)
|
||||
[.. speed, jump_height, dmg, kbPlayer, {buttonActivation}] with
|
||||
all\{dmg} = double[>=0.0]
|
||||
dmg = int (>=0)
|
||||
buttonActivation = int[0-16]
|
||||
|
||||
-> 17 (type 2 entity)
|
||||
[.. speed, jump_height, dmg, kbPlayer, kbEntity, {buttonActivation}] with
|
||||
all\{dmg} = double[>=0.0]
|
||||
dmg = int (>=0)
|
||||
buttonActivation = int[0-16]
|
||||
|
||||
```
|
BIN
obj/base.o
BIN
obj/base.o
Binary file not shown.
BIN
obj/cars.o
BIN
obj/cars.o
Binary file not shown.
BIN
obj/rooms.o
BIN
obj/rooms.o
Binary file not shown.
|
@ -36,6 +36,8 @@ void destroy_all() {
|
|||
free(players);
|
||||
}
|
||||
|
||||
// ------------------------- //
|
||||
|
||||
int ln_baseN(int n, int b) {
|
||||
if(n<b) {
|
||||
return 0;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
car* init_car(const char* name) {
|
||||
car* res = malloc(sizeof(car));
|
||||
res->name = "e";
|
||||
res->size = 40;
|
||||
res->itm = NULL;
|
||||
res->nCoins = 0;
|
||||
res->pos = (ptf){.fx = 0.0, .fy = 0.0};
|
||||
|
|
|
@ -20,6 +20,7 @@ chunk** allRooms;
|
|||
int nMaxRooms;
|
||||
int curRoom;
|
||||
|
||||
// returns the index of the new chunk
|
||||
int build_empty_room(int CX, int CY, int w, int h, chunk* north, chunk* east, chunk* south, chunk* west) {
|
||||
if(curRoom < nMaxRooms) {
|
||||
chunk* res = malloc(sizeof(chunk));
|
||||
|
|
|
@ -12,17 +12,12 @@ typedef struct imgs {
|
|||
// ------------------------------------------------------------------------ //
|
||||
// car shenanigans
|
||||
|
||||
typedef struct pt_t {
|
||||
int ix;
|
||||
int iy;
|
||||
} pt;
|
||||
typedef struct pt_t {int ix; int iy;} pt;
|
||||
|
||||
typedef struct ptf_t {
|
||||
double fx;
|
||||
double fy;
|
||||
} ptf;
|
||||
typedef struct ptf_t {double fx; double fy;} ptf;
|
||||
|
||||
typedef struct car_t car;
|
||||
|
||||
// unused for now
|
||||
typedef struct item_t {
|
||||
const char* name;
|
||||
|
@ -33,6 +28,7 @@ typedef struct item_t {
|
|||
typedef struct car_t {
|
||||
const char* name;
|
||||
ptf pos;
|
||||
int size;
|
||||
ptf vel;
|
||||
int nCoins;
|
||||
item* itm; // either NULL or a pointer to an item
|
||||
|
@ -46,6 +42,7 @@ typedef struct color_t {
|
|||
uint8_t blue;
|
||||
} color;
|
||||
|
||||
// 2 types of objects : rectangles and circles
|
||||
typedef struct rectangle_t {
|
||||
int x;
|
||||
int y;
|
||||
|
@ -73,34 +70,37 @@ typedef struct chunk_t {
|
|||
circle* circles;
|
||||
int nCircles;
|
||||
|
||||
// size of the chunk
|
||||
int chW;
|
||||
int chH;
|
||||
|
||||
// absolute coords
|
||||
int chX;
|
||||
int chY;
|
||||
|
||||
// neighbors
|
||||
struct chunk_t* north;
|
||||
struct chunk_t* east;
|
||||
struct chunk_t* south;
|
||||
struct chunk_t* west;
|
||||
} chunk;
|
||||
|
||||
// global car data here
|
||||
// global car data
|
||||
typedef struct carData_t {
|
||||
car* c;
|
||||
chunk* curChunk;
|
||||
} carData;
|
||||
|
||||
// ------------------------------------------------------------------------ //
|
||||
extern imgs* digits;
|
||||
extern imgs* letters;
|
||||
extern imgs* digits; // SDL data
|
||||
extern imgs* letters; // SDL data
|
||||
|
||||
extern int currentTurn;
|
||||
extern int currentTurn; // name explains
|
||||
|
||||
extern chunk* start;
|
||||
extern chunk** allRooms;
|
||||
extern int nMaxRooms;
|
||||
extern carData* players;
|
||||
extern int nPlayers;
|
||||
extern chunk* start; // starting chunk
|
||||
extern chunk** allRooms; // an array containing every generated room, used for free()
|
||||
extern int nMaxRooms; // size of allRooms
|
||||
extern carData* players; // contains each player and its corresponding data
|
||||
extern int nPlayers; // size of players
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue