added level_01, beat blocks, lock blocks and reworked stats

This commit is contained in:
Alexandre 2025-02-21 15:50:18 +01:00
parent 462a505da7
commit 8e567fc419
37 changed files with 697 additions and 36 deletions

BIN
bin/back

Binary file not shown.

View File

@ -6,11 +6,14 @@ Blocks :
[13.0, 0.0, 13.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
Entities:
[-0.5, 5.0, -0.5, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 0, 10, 0, 0]
[-11.0, 0.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 6, welcome here, 222, 222, 222]
[9.0, 0.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 0, 1, 0, 6, collect coins to advance, 222, 222, 111]
[-1.0, 0.0, -11.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 0, 0, 1, 0, 6, if HP goes to 0 its game over, 222, 222, 111]
[-1.0, 0.0, 9.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0, 0, 255, 1, 0, 6, enjoy, 222, 222, 111]
[-0.5 , 5.0, -0.5 , 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 0 , 10, 0, 0]
[-11.0, 0.0, -1.0 , 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1 , 0, 6, welcome here, 222, 222, 222]
[9.0 , 0.0, -1.0 , 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 128, 1 , 0, 6, collect coins to advance, 222, 222, 111]
[-1.0 , 0.0, -11.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 128, 128, 1 , 0, 6, if HP goes to 0 its game over, 222, 222, 111]
[-1.0 , 2.1, -11.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 128, 128, 1 , 0, 6, dont fall off the map, 222, 222, 111]
[-1.0 , 0.0, 9.0 , 2.0, 2.0, 2.0, 0.0, 0.0, 128, 128, 255, 1 , 0, 6, enjoy, 222, 222, 111]
[5.0 , 1.0, 5.0 , 4.0, 4.0, 4.0, 0.0, 0.0, 255, 255, 128, 1 , 0, 8, 15, 1, 128, 128, 128]
[6.0 , 2.0, 6.0 , 2.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1 , 0, 7, levels/level_01/, 7, nice, 192, 192, 192]
Weight :
0
@ -25,7 +28,7 @@ teleporters:
entities:
[x, y, z, w, h, d, rhz, rvt, r, g, b, hp, damage, entityType ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 0 (coin) -> HP equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
@ -45,9 +48,20 @@ entities:
text = {char*}
// else if entityType = 7 (warp text box)
[.. dest_folder, room_count, text, tred, tgreen, tblue] with
[.. dest_folder, room_count, text, tred, tgreen, tblue] with
{dest_folder,text} = {char*} (length <= 50)
{r,g,b} = int[0-256]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
// else if entityType = 9 (beat block)
[.. time_on, time_off, start] with
time_{on,off} = double[>0.0]
else
[..]

View File

@ -1,5 +1,5 @@
Blocks :
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
[-14.0, -1.0, -14.0, 28.0, 1.0, 28.0, 0.0, 0.0, 128, 128, 128]
[-1.0, 0.0, -15.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[-1.0, 0.0, 13.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[-15.0, 0.0, -1.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]

View File

@ -1,5 +1,5 @@
Blocks :
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
[-14.0, -1.0, -14.0, 28.0, 1.0, 28.0, 0.0, 0.0, 128, 128, 128]
[-15.0, 0.0, -15.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[-15.0, 0.0, 13.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[13.0, 0.0, -15.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]

View File

@ -1,5 +1,8 @@
Blocks :
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
[-14.0, -1.0, -14.0, 28.0, 1.0, 28.0, 0.0, 0.0, 128, 128, 128]
Entities :
[-0.5, 2.0, -0.5, 1.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192, 2, 0, 0]
Weight :
50

59
levels/level_01/room_0 Normal file
View File

@ -0,0 +1,59 @@
Blocks :
[-16.0, -1.0, -16.0, 32.0, 1.0, 32.0, 0.0, 0.0, 128, 128, 128]
[-5.0, 13.0, -5.0, 10.0, 1.0, 10.0, 0.0, 0.0, 255, 255, 255]
[-1.0, 0.0, -15.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[-1.0, 0.0, 13.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[-15.0, 0.0, -1.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
[13.0, 0.0, -1.0, 2.0, 10.0, 2.0, 0.0, 0.0, 128, 128, 128]
Entities:
[-1.0, 15.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 10, 0]
[2.0 , 0.0 , 2.0 , 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0 , 6, hope you like parkour, 255, 192, 192]
[-2.0, 1.0 , -2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 128, 1, 0 , 8, 50, 1, 128, 128, 128]
[-1.5, 1.5 , -1.5, 1.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192, 1, 0 , 7, levels/level_01/, 7, great, 192, 192, 192]
Weight :
0
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

65
levels/level_01/room_1 Normal file
View File

@ -0,0 +1,65 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-2.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 12.5]
[-14.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
[ 12.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
Weight :
50
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

65
levels/level_01/room_2 Normal file
View File

@ -0,0 +1,65 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-2.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.0, 0.0, 0.0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 12.5, 0.0, 0.0]
[-1.0, 7.5, -14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
[-1.0, 7.5, 12.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 5, 0.0, 7.5, 0.0, 0.0, 10.0, 0.0]
Weight :
50
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

65
levels/level_01/room_3 Normal file
View File

@ -0,0 +1,65 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-2.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
[-14.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
[ 12.0, 7.5, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
Weight :
50
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

65
levels/level_01/room_4 Normal file
View File

@ -0,0 +1,65 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-2.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, -2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-2.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[ 1.0, 16.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 128, 1, 2, 0]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
[-1.0, 7.5, -14.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 90]
[-1.0, 7.5, 12.0, 2.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 0.0, 7.5, 0.0, 4, 3, 270]
Weight :
50
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

61
levels/level_01/room_5 Normal file
View File

@ -0,0 +1,61 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 6.0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 0.0, 0.0, 13.7, 0.0, 0.0, 8.0]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 6.0, 0.0, 0.0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 5, 13.7, 0.0, 0.0, 8.0, 0.0, 0.0]
Weight :
75
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

65
levels/level_01/room_6 Normal file
View File

@ -0,0 +1,65 @@
Blocks :
[-16.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 1.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 1.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-16.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[15.0, 15.0, -1.0, 1.0, 1.0, 2.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, -16.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
[-1.0, 15.0, 15.0, 2.0, 1.0, 1.0, 0.0, 0.0, 192, 192, 192]
Entities :
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 0.0, 0.0, 13.7, 1, 1, 180]
[-1.0, 1.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 0]
[-1.0, 15.0, -1.0, 2.0, 1.0, 2.0, 0.0, 0.0, 128, 128, 128, 1, 0, 4, 13.7, 0.0, 0.0, 1, 1, 180]
[-3.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 0]
[-3.0, 7.5, 2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 90]
[ 2.0, 7.5, -3.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 180]
[ 2.0, 7.5, 2.0, 1.0, 1.0, 1.0, 0.0, 0.0, 255, 255, 255, 1, 0, 4, 0.0, 7.5, 0.0, 1, 2, 270]
Weight :
75
$
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 ..]
// Entity types are :
// 0 (coin) -> damage equals the coin's value
// 1 (still explosive)
// 2 (seeking explosive)
// 3 (shooting still explosive)
// if entityType = 4 (moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with
amplitude_{x,y,z} = double[>= 0.0]
{mult,divd} = int
{phase} = int[0, 360]
// else if entityType = 5 (linear moving platform)
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
amplitude_{x,y,z} = double[>= 0.0]
speed_{x,y,z} = double
// else if entityType = 6 (text box)
[.. text, tred, tgreen, tblue] with
text = {char*}
// else if entityType = 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]
// else if entityType = 8 (lock box)
[.. cost, doPay, tred, tgreen, tblue] with
cost = int[> 0] (0 breaks)
doPay = {0, 1} (bool)
else
[..]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
res/beat_off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
res/beat_on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
res/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -98,6 +98,21 @@ double absf(double n) {
}
}
// n >= 0
int reverse(int n) {
int res = 0;
int nexp = pw(10, ln_baseN(n, 10));
int cexp = nexp/10;
int left = n;
while(cexp > 0) {
res += (left%10)*cexp;
cexp /= 10;
left /= 10;
}
//printf("%d -> %d\n", n, res);
return res;
}
int convex_seg(int x1, int x2, double theta) {
return (int)(((1.0f - theta) * x1 + theta * x2));
}

View File

@ -12,6 +12,7 @@ double maxd(double a, double b);
float minf(float a, float b);
float maxf(float a, float b);
double absf(double n);
int reverse(int n);
int convex_seg(int x1, int x2, double theta);
double convex_tri(double a, double tha, double b, double thb, double c, double thc);
pt_2d convex_pt2d(pt_2d A, pt_2d B, double theta);

View File

@ -179,7 +179,12 @@ void gl_renderAll(unsigned int shaderProgram, unsigned int fragmentShader, unsig
for(int k = 0; k < rtd->ent_len; k++) {
if(is_visible(rtd->ents[k]->pos, offx, offy, offz)) {
//printf("%d\n", rtd->ents[k]->tex);
glBindTexture(GL_TEXTURE_2D, textures[rtd->ents[k]->tex]);
if(rtd->ents[k]->entity_type != 9 || /* entityType == 9 */rtd->ents[k]->metai1) {
glBindTexture(GL_TEXTURE_2D, textures[rtd->ents[k]->tex]);
} else {
//printf(">>%d<<\n", rtd->ents[k]->tex2);
glBindTexture(GL_TEXTURE_2D, textures[rtd->ents[k]->tex2]);
}
gl_renderCube(shaderProgram, fragmentShader, VAO, VBO, rtd->ents[k]->pos, offx, offy, offz);
}
}

View File

@ -123,6 +123,22 @@ void moving_xyz_line(double x, double y, double z, double w, double h, double d,
}
}
// metad1 = time ON
// metad2 = time OFF
// metad3 = current time left
// metai1 = 0 if OFF, 1 if ON
void beating_block(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret) {
ent->metad3 -= dtime;
if(ent->metad3 <= 0.0) {
if(ent->metai1) {
ent->metad3 = ent->metad2;
} else {
ent->metad3 = ent->metad1;
}
ent->metai1 = 1-ent->metai1;
}
}
void detectHit(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
if(ret->red == 193) {
ret->red = 0;
@ -214,3 +230,18 @@ void pop_and_tp(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
//printf("%s %d\n", newRoomName, newRoomCount);
switchRoom = true;
}
// metai1 = id of the interface
// metai2 = price
// metai3 = doPay
// metach1 = text (stored here to free() easily)
void locker(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
//printf("%d %d %d <<<<\n", ent->metai1, ent->metai2, ent->metai3);
interface_set(ent->metai1);
if(coins >= ent->metai2) {
if(ent->metai3) {
coins -= ent->metai2;
}
*hp = 0;
}
}

View File

@ -15,6 +15,7 @@ void speen3(double x, double y, double z, double w, double h, double d, double h
void moving_xyz(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret);
void moving_xyz_line(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret);
void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret);
void beating_block(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret);
void detectHit(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
void money(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
@ -23,5 +24,6 @@ void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
void translatePlayerLine(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
void pop_text(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
void pop_and_tp(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
void locker(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret);
#endif

View File

@ -42,6 +42,7 @@ void init_ent_generator(int n) {
hashtbl_entities[0].id = 0;
hashtbl_entities[0].tex = 3;
hashtbl_entities[0].tex2 = 3;
hashtbl_entities[0].name = "Coin"; // 0 = default
hashtbl_entities[0].updatePos = &speen;
hashtbl_entities[0].onHit = &money;
@ -49,6 +50,7 @@ void init_ent_generator(int n) {
hashtbl_entities[1].id = 1;
hashtbl_entities[1].tex = 0;
hashtbl_entities[1].tex2 = 0;
hashtbl_entities[1].name = "ExplosiveStill";
hashtbl_entities[1].updatePos = &speen2;
hashtbl_entities[1].onHit = &explodeOnHit;
@ -56,6 +58,7 @@ void init_ent_generator(int n) {
hashtbl_entities[2].id = 2;
hashtbl_entities[2].tex = 0;
hashtbl_entities[2].tex2 = 0;
hashtbl_entities[2].name = "ExplosiveSeek";
hashtbl_entities[2].updatePos = &go_to_player;
hashtbl_entities[2].onHit = &explodeOnHit;
@ -63,6 +66,7 @@ void init_ent_generator(int n) {
hashtbl_entities[3].id = 3;
hashtbl_entities[3].tex = 0;
hashtbl_entities[3].tex2 = 0;
hashtbl_entities[3].name = "ExplosiveShoot";
hashtbl_entities[3].updatePos = &speen3;
hashtbl_entities[3].onHit = &explodeOnHit;
@ -70,6 +74,7 @@ void init_ent_generator(int n) {
hashtbl_entities[4].id = 4;
hashtbl_entities[4].tex = 4;
hashtbl_entities[4].tex2 = 4;
hashtbl_entities[4].name = "SinePlatform";
hashtbl_entities[4].updatePos = &moving_xyz;
hashtbl_entities[4].onHit = &translatePlayer;
@ -77,6 +82,7 @@ void init_ent_generator(int n) {
hashtbl_entities[5].id = 5;
hashtbl_entities[5].tex = 4;
hashtbl_entities[5].tex2 = 4;
hashtbl_entities[5].name = "LinePlatform";
hashtbl_entities[5].updatePos = &moving_xyz_line;
hashtbl_entities[5].onHit = &translatePlayerLine;
@ -84,6 +90,7 @@ void init_ent_generator(int n) {
hashtbl_entities[6].id = 6;
hashtbl_entities[6].tex = 1;
hashtbl_entities[6].tex2 = 1;
hashtbl_entities[6].name = "TextBox";
hashtbl_entities[6].updatePos = NULL;
hashtbl_entities[6].onHit = &pop_text;
@ -91,10 +98,27 @@ void init_ent_generator(int n) {
hashtbl_entities[7].id = 7;
hashtbl_entities[7].tex = 2;
hashtbl_entities[7].tex2 = 2;
hashtbl_entities[7].name = "WarpBox";
hashtbl_entities[7].updatePos = NULL;
hashtbl_entities[7].onHit = &pop_and_tp;
hashtbl_entities[7].onDeath = NULL;
hashtbl_entities[8].id = 8;
hashtbl_entities[8].tex = 7;
hashtbl_entities[7].tex2 = 7;
hashtbl_entities[8].name = "Lock";
hashtbl_entities[8].updatePos = NULL;
hashtbl_entities[8].onHit = &locker;
hashtbl_entities[8].onDeath = NULL;
hashtbl_entities[9].id = 9;
hashtbl_entities[9].tex = 8;
hashtbl_entities[9].tex2 = 9;
hashtbl_entities[9].name = "BeatBlock";
hashtbl_entities[9].updatePos = &beating_block;
hashtbl_entities[9].onHit = NULL;
hashtbl_entities[9].onDeath = NULL;
}
fct_entry* get_entry(int k0) {
@ -138,8 +162,10 @@ void copy_room(room* src, room* dest, int chx, int chy) {
dest->ent_len = src->ent_len;
for(int k = 0; k < src->ent_len; k++) {
dest->ents[k] = malloc(sizeof(entity));
dest->ents[k]->entity_type = src->ents[k]->entity_type;
dest->ents[k]->damage = src->ents[k]->damage;
dest->ents[k]->tex = src->ents[k]->tex;
dest->ents[k]->tex2 = src->ents[k]->tex2;
//printf("!! %d !!\n", dest->ents [k]->tex);
dest->ents[k]->hitpoints = malloc(sizeof(int));
dest->ents[k]->metai1 = src->ents[k]->metai1;
@ -159,10 +185,6 @@ void copy_room(room* src, room* dest, int chx, int chy) {
dest->ents[k]->metad9 = src->ents[k]->metad9;
dest->ents[k]->metach1 = src->ents[k]->metach1;
dest->ents[k]->metach2 = src->ents[k]->metach2;
//dest->ents[k]->metach1 = malloc(sizeof(char)*52);
//dest->ents[k]->metach2 = malloc(sizeof(char)*52);
//strcpy(dest->ents[k]->metach1, src->ents[k]->metach1);
//strcpy(dest->ents[k]->metach2, src->ents[k]->metach2);
*(dest->ents[k]->hitpoints) = *(src->ents[k]->hitpoints);
dest->ents[k]->pos = create_cube_0(
(*(src->ents[k]->pos)).x, (*(src->ents[k]->pos)).y, (*(src->ents[k]->pos)).z,
@ -432,10 +454,12 @@ void parse_one_room(int id, char* filename) {
fill_cube_0(pool[id].area->ents[k]->pos, cx, cy, cz, cw, ch, cd, chz, cvt, red, green, blue);
pool[id].area->ents[k]->damage = dmg;
pool[id].area->ents[k]->tex = entry->tex;
pool[id].area->ents[k]->tex2 = entry->tex2;
*(pool[id].area->ents[k]->hitpoints) = hp;
pool[id].area->ents[k]->updatePos = entry->updatePos;
pool[id].area->ents[k]->onHit = entry->onHit ;
pool[id].area->ents[k]->onDeath = entry->onDeath ;
pool[id].area->ents[k]->onHit = entry->onHit;
pool[id].area->ents[k]->onDeath = entry->onDeath;
pool[id].area->ents[k]->entity_type = entry->id;
pool[id].area->ents[k]->metai1 = entry->metai1;
pool[id].area->ents[k]->metai2 = entry->metai2;
pool[id].area->ents[k]->metai3 = entry->metai3;
@ -516,6 +540,69 @@ void parse_one_room(int id, char* filename) {
pool[id].area->ents[k]->metai1 = build_text_box(msg, ired, igreen, iblue);
pool[id].area->ents[k]->metai2 = count;
pool[id].area->ents[k]->metai3 = (-72727); // random value to recognize
} else if(entry->id == 8) {
// lock box
int cost = read_int(ptr, true); // assume cost > 0
int doPay = read_int(ptr, true);
//printf("%d %d --------<>---------\n", cost, doPay);
int ired = read_int(ptr, true);
int igreen = read_int(ptr, true);
int iblue = read_int(ptr, true);
int nsize = 1+ln_baseN(cost, 10);
// char* test = "you need 0 to pass"; char[19] //
char* msg = malloc(sizeof(int)*(nsize+25));
to_free[to_length] = msg;
to_length += 1;
msg[0] = 'y'; msg[1] = 'o'; msg[2] = 'u'; msg[3] = ' ';
msg[4] = 'n'; msg[5] = 'e'; msg[6] = 'e'; msg[7] = 'd'; msg[8] = ' ';
int ki = 9;
int csize = nsize-1;
int left = reverse(cost);
while(csize > 0) {
msg[ki] = (char)(48 + left%10);
left = left/10;
csize -= 1;
ki += 1;
}
// at the end, k=10 if cost has one single digit (<==> nsize = 1)
msg[ki] = ' '; ki += 1;
msg[ki] = 'c'; ki += 1;
msg[ki] = 'o'; ki += 1;
msg[ki] = 'i'; ki += 1;
msg[ki] = 'n'; ki += 1;
msg[ki] = 's'; ki += 1;
msg[ki] = ' '; ki += 1;
msg[ki] = 't'; ki += 1;
msg[ki] = 'o'; ki += 1;
msg[ki] = ' '; ki += 1;
msg[ki] = 'p'; ki += 1;
msg[ki] = 'a'; ki += 1;
msg[ki] = 's'; ki += 1;
msg[ki] = 's'; ki += 1;
msg[ki] = '\0';
// k=18 if singlt digit
pool[id].area->ents[k]->metai1 = build_text_box(msg, ired, igreen, iblue);
pool[id].area->ents[k]->metai2 = cost;
pool[id].area->ents[k]->metai3 = doPay;
pool[id].area->ents[k]->metach1 = msg;
} else if(entry->id == 9) {
// beat block
double ontime = read_float(ptr);
double offtime = read_float(ptr);
int stst = read_int(ptr, true);
if(stst != 0 && stst != 1) {
stst = 1;
}
pool[id].area->ents[k]->metad1 = ontime;
pool[id].area->ents[k]->metad2 = offtime;
pool[id].area->ents[k]->metad3 = 0.0;
pool[id].area->ents[k]->metai1 = 1-stst;
} else {
pool[id].area->ents[k]->metai3 = 0;
}

View File

@ -35,9 +35,11 @@ typedef struct fct_entry {
char* metach2;
int tex;
int tex2;
} fct_entry ;
extern int build_text_box(char* msg, int red, int green, int blue);
extern int build_lock_box(char* msg, int red, int green, int blue);
void init_ent_generator(int n);

View File

@ -218,7 +218,7 @@ void processInput(GLFWwindow *window, float dtime) {
if(!gPress) {
gPress = true;
gamemode = 1-gamemode;
njumps = 3;
njumps = 1;
camvx = 0.0;
camvy = 0.0;
camvz = 0.0;
@ -246,6 +246,7 @@ void processInput(GLFWwindow *window, float dtime) {
if(glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {
if(!isMenuOpen() && !rPress) {
rPress = true;
//reset_everything(window, 4, "levels/level_00/");
reset_everything(window, 4, "levels/level_00/");
}
} else {
@ -441,6 +442,9 @@ int main_alt() {
generate_texture(4, "res/container.jpg", JPG);
generate_texture(5, "res/steel.jpeg", JPEG);
generate_texture(6, "res/gateway.jpeg", JPEG);
generate_texture(7, "res/lock.png", PNG);
generate_texture(8, "res/beat_on.png", PNG);
generate_texture(9, "res/beat_off.png", PNG);
printf("-----------------------------------------------------------------------------------------------\n"); fflush(stdout);

View File

@ -394,6 +394,8 @@ void gl_initDrawRect(unsigned int shaderProgram) {
glUseProgram(shaderProgram);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------------------------------------------------------------------------ //
// ------------------------------------------------------------------------------------------------------------------------------------------------ //
static onoff_button* buttonList;
@ -680,6 +682,7 @@ int button_create_onoff(char* text, int red, int green, int blue, float x, float
bListId += 1;
return (bListId-1);
} else {
fprintf(stderr, "WARNING : max button capacity reached.\n");
return -1;
}
}
@ -706,6 +709,7 @@ int interface_create(char* title, int red, int green, int blue, float x, float y
intListId += 1;
return (intListId-1);
} else {
fprintf(stderr, "WARNING : max interface capacity reached.\n");
return -1;
}
}
@ -756,6 +760,7 @@ void interface_set(int interface_id) {
// build and link everything here
int button_ok;
int button_pay;
void build_all_menus() {
int welcome_start_go = button_create_onoff("start", 0, 255, 255, -0.25f, 0.05f, 0.5f, 0.3f, EXIT, NULL, 0.0, 0.0, INT, NULL, NULL);
int welcome_start_settings = button_create_onoff("config", 96, 96, 96, -0.25f, -0.35f, 0.5f, 0.3f, WARP, &(numbers[1]), INT, 0.0, 0.0, NULL, NULL);
@ -777,6 +782,7 @@ void build_all_menus() {
interface_link_button(settings_i, settings_exit);
button_ok = button_create_onoff("ok", 32, 255, 32, -0.2f, -0.9f, 0.4f, 0.3f, EXIT, NULL, 0.0, 0.0, INT, NULL, NULL);
button_pay = button_create_onoff("advance", 32, 255, 32, -0.2f, -0.9f, 0.4f, 0.3f, EXIT, NULL, 0.0, 0.0, INT, NULL, NULL);
interface_set(welcome_start_i);
}
@ -788,3 +794,12 @@ int build_text_box(char* msg, int red, int green, int blue) {
return intf;
}
// returns the ID of the newly created interface
int build_lock_box(char* msg, int red, int green, int blue) {
int intf = interface_create(msg, red, green, blue, -0.9f, 0.05f, 1.8f, 0.85f);
interface_link_button(intf, button_pay);
return intf;
}

View File

@ -64,5 +64,6 @@ void interface_set(int interface_id);
void build_all_menus();
int build_text_box(char* msg, int red, int green, int blue);
int build_lock_box(char* msg, int red, int green, int blue);
#endif

View File

@ -78,7 +78,7 @@ void init_csts() {
coins = 0;
player_hp = 1000;
njumps = 3;
njumps = 1;
draw_type = 0;
fade_dmg = 0;
@ -218,6 +218,22 @@ bool is_colliding(float dtime) {
return true;
}
}
for(int w = -1; w <= 1; w++) {
for(int h = -1; h <= 1; h++) {
room* vstd = hashtbl_find_opt(visited, player_chx+w, player_chy+h);
if(vstd != NULL) {
for(int k = 0; k < vstd->map_size; k++) {
double dist = distance_pt_cube_0_3d_infinite(camx-2*room_width*w, camy, camz-2*room_depth*h, vstd->map[k]);
if(dist <= min_dist) {
if(updateForces) {
updateF(vstd->map[k], (double)dtime);
}
return true;
}
}
}
}
}
for(int k = 0; k < current_room->tps_size; k++) {
double dist = distance_pt_cube_0_3d_infinite(camx, camy, camz, current_room->tps[k]->hitbox);
if(dist <= min_dist) {
@ -235,23 +251,28 @@ bool is_colliding(float dtime) {
}
}
for(int k = 0; k < current_room->ent_len; k++) {
double dist = distance_pt_cube_0_3d_infinite(camx, camy, camz, current_room->ents[k]->pos);
if(dist <= min_dist) {
if(current_room->ents[k]->onHit != NULL) {
(*current_room->ents[k]->onHit)(dtime, current_room->ents[k]->hitpoints, &current_room->ents[k]->damage, current_room->ents[k], &(*(current_room->ents[k]->pos)));
if(*(current_room->ents[k]->hitpoints) <= 0) {
if(current_room->ents[k]->onDeath != NULL) {
(*current_room->ents[k]->onDeath)(dtime);
}
remove_entity(current_room->ents, &current_room->ent_memlen, &current_room->ent_len, k);
} else {
if(updateForces) {
updateF(current_room->ents[k]->pos, (double)dtime);
//printf("%d -> %d\n", k, current_room->ents[k]->entity_type);
if(current_room->ents[k]->entity_type != 9 || /* entityType == 9 */current_room->ents[k]->metai1) {
double dist = distance_pt_cube_0_3d_infinite(camx, camy, camz, current_room->ents[k]->pos);
//printf("%lf vs %lf\n", dist, min_dist);
if(dist <= min_dist) {
if(current_room->ents[k]->onHit != NULL) {
(*current_room->ents[k]->onHit)(dtime, current_room->ents[k]->hitpoints, &current_room->ents[k]->damage, current_room->ents[k], &(*(current_room->ents[k]->pos)));
if(*(current_room->ents[k]->hitpoints) <= 0) {
if(current_room->ents[k]->onDeath != NULL) {
(*current_room->ents[k]->onDeath)(dtime);
}
remove_entity(current_room->ents, &current_room->ent_memlen, &current_room->ent_len, k);
}
}
if(updateForces) {
updateF(current_room->ents[k]->pos, (double)dtime);
}
if(current_room->ents[k]->entity_type == 9) {
is_clipping = false;
}
return true;
}
is_clipping = false;
return true;
}
}
return false;
@ -291,7 +312,7 @@ void movePlayerG(float dtime) {
camvz += fz*dtime;
//printf("%lf | %lf | %lf\n\n", camvx, camvy, camvz);
if(isfalling && camvy > 0.0) {
njumps = 3;
njumps = 1;
}
camx += camvx*dtime;
camy += camvy*dtime;
@ -301,8 +322,18 @@ void movePlayerG(float dtime) {
camvy *= (1.0 - friction*((double)(dtime)));
camvz *= (1.0 - friction*((double)(dtime)));
if(camy <= -64) {
player_hp -= (int)(400*dtime);
if(camy <= -48) {
camx = 0.0;
camz = 0.0;
camy = 5.0;
camvx = 0.0;
camvy = 0.0;
camvz = 0.0;
player_chx = 0;
player_chy = 0;
player_hp -= 250;
current_room = hashtbl_find_opt(visited, player_chx, player_chy);
resetProj();
}
}

View File

@ -31,6 +31,7 @@ typedef struct teleporter {
} teleporter;
typedef struct entity {
int entity_type;
cube_0* pos;
// act as velocity function
void (*updatePos)(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, struct entity* ent, cube_0* ret);
@ -60,6 +61,7 @@ typedef struct entity {
char* metach2;
int tex;
int tex2;
int damage;
int* hitpoints;

View File

@ -12,6 +12,9 @@ Teleporters :
[4.0, 1.0, 9.0, 2.0, 4.0, 1.0, 0.0, 0.0, 0, 255, 0; 1, 0]
[9.0, 1.0, 4.0, 1.0, 4.0, 2.0, 0.0, 0.0, 0, 0, 255; 0, 1]
Entities :
[-1.0, 13.0, -1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 255, 255, 255, 1, 0, 9, 1.5, 1.5, 0]
Weight :
50