added syntax for optionnal arguments + buttons can now halt/start platform movement
This commit is contained in:
parent
89b1637d46
commit
1258be1e78
|
@ -23,6 +23,9 @@ below is a detailled list for all block types ;
|
||||||
each block type (Blocks, Teleporters, Entities) must have the corresponding word directly above it
|
each block type (Blocks, Teleporters, Entities) must have the corresponding word directly above it
|
||||||
not all three keywords have to be written
|
not all three keywords have to be written
|
||||||
|
|
||||||
|
[] is mandatory data
|
||||||
|
{} is optionnal data
|
||||||
|
|
||||||
*Data-specific structure :*
|
*Data-specific structure :*
|
||||||
```
|
```
|
||||||
blocks:
|
blocks:
|
||||||
|
@ -52,15 +55,17 @@ entities:
|
||||||
{all} = double[>= 0.0]
|
{all} = double[>= 0.0]
|
||||||
|
|
||||||
-> 4 (moving platform)
|
-> 4 (moving platform)
|
||||||
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase] with *<- extra arguments at the end of []*
|
[.. amplitude_x, amplitude_y, amplitude_z, mult, divd, phase, {initialState, triggerButton}] with
|
||||||
amplitude_{x,y,z} = double[>= 0.0]
|
amplitude_{x,y,z} = double[>= 0.0]
|
||||||
{mult,divd} = int
|
{mult,divd} = int
|
||||||
{phase} = int[0, 360]
|
{phase} = int[0, 360]
|
||||||
|
{..} = int(>=0)
|
||||||
|
|
||||||
-> 5 (linear moving platform)
|
-> 5 (linear moving platform)
|
||||||
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z] with
|
[.. amplitude_x, amplitude_y, amplitude_z, speed_x, speed_y, speed_z, {initialState, triggerButton}] with
|
||||||
amplitude_{x,y,z} = double[>= 0.0]
|
amplitude_{x,y,z} = double[>= 0.0]
|
||||||
speed_{x,y,z} = double
|
speed_{x,y,z} = double
|
||||||
|
{..} = int(>=0)
|
||||||
|
|
||||||
-> 6 (text box)
|
-> 6 (text box)
|
||||||
[.. text, tred, tgreen, tblue] with
|
[.. text, tred, tgreen, tblue] with
|
||||||
|
|
|
@ -79,33 +79,36 @@ Entities:
|
||||||
[-33.0, 24.0, 18.0, 2.0, 2.0, 2.0, 0.71, 0.0, 92, 92, 92, 1, 0, 11, 1, 10.0]
|
[-33.0, 24.0, 18.0, 2.0, 2.0, 2.0, 0.71, 0.0, 92, 92, 92, 1, 0, 11, 1, 10.0]
|
||||||
|
|
||||||
|
|
||||||
[-5.0, 20.0, -18.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0] // 3 - platforms
|
[-5.0, 20.0, -18.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0, {1, 1}] // 3 - platforms
|
||||||
[-5.0, 20.0, -20.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 30]
|
[-5.0, 20.0, -20.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 30, {1, 1}]
|
||||||
[-5.0, 20.0, -22.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 60]
|
[-5.0, 20.0, -22.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 60, {1, 1}]
|
||||||
[-5.0, 20.0, -24.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 90]
|
[-5.0, 20.0, -24.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 90, {1, 1}]
|
||||||
[-5.0, 20.0, -26.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 120]
|
[-5.0, 20.0, -26.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 120, {1, 1}]
|
||||||
[-5.0, 20.0, -28.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 150]
|
[-5.0, 20.0, -28.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 150, {1, 1}]
|
||||||
[-5.0, 20.0, -30.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180]
|
[-5.0, 20.0, -30.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180, {1, 1}]
|
||||||
[-5.0, 20.0, -32.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 210]
|
[-5.0, 20.0, -32.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 210, {1, 1}]
|
||||||
[-5.0, 20.0, -34.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 240]
|
[-5.0, 20.0, -34.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 240, {1, 1}]
|
||||||
[-5.0, 20.0, -36.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 270]
|
[-5.0, 20.0, -36.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 270, {1, 1}]
|
||||||
[-5.0, 20.0, -38.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 300]
|
[-5.0, 20.0, -38.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 300, {1, 1}]
|
||||||
[-5.0, 20.0, -40.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 330]
|
[-5.0, 20.0, -40.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 330, {1, 1}]
|
||||||
[-5.0, 20.0, -42.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0]
|
[-5.0, 20.0, -42.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0, {1, 1}]
|
||||||
|
|
||||||
[-5.0, 20.0, -18.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180]
|
[-5.0, 20.0, -18.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180, {1, 1}]
|
||||||
[-5.0, 20.0, -20.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 210]
|
[-5.0, 20.0, -20.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 210, {1, 1}]
|
||||||
[-5.0, 20.0, -22.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 240]
|
[-5.0, 20.0, -22.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 240, {1, 1}]
|
||||||
[-5.0, 20.0, -24.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 270]
|
[-5.0, 20.0, -24.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 270, {1, 1}]
|
||||||
[-5.0, 20.0, -26.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 300]
|
[-5.0, 20.0, -26.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 300, {1, 1}]
|
||||||
[-5.0, 20.0, -28.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 330]
|
[-5.0, 20.0, -28.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 330, {1, 1}]
|
||||||
[-5.0, 20.0, -30.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0]
|
[-5.0, 20.0, -30.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 0, {1, 1}]
|
||||||
[-5.0, 20.0, -32.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 30]
|
[-5.0, 20.0, -32.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 30, {1, 1}]
|
||||||
[-5.0, 20.0, -34.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 60]
|
[-5.0, 20.0, -34.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 60, {1, 1}]
|
||||||
[-5.0, 20.0, -36.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 90]
|
[-5.0, 20.0, -36.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 90, {1, 1}]
|
||||||
[-5.0, 20.0, -38.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 120]
|
[-5.0, 20.0, -38.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 120, {1, 1}]
|
||||||
[-5.0, 20.0, -40.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 150]
|
[-5.0, 20.0, -40.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 150, {1, 1}]
|
||||||
[-5.0, 20.0, -42.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180]
|
[-5.0, 20.0, -42.0, 4.0, 2.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 4, 10.0, 0.0, 0.0, 3, 2, 180, {1, 1}]
|
||||||
|
|
||||||
|
|
||||||
|
[ -5.0, 23.0, -45.0, 4.0, 4.0, 4.0, 0.0, 0.0, 115, 24, 24, 1, 0, 11, 1, 10.0] // platform halt button
|
||||||
|
|
||||||
|
|
||||||
[ 12.0, 20.0, -20.0, 2.0, 8.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 11, 2, 20.0] // 3 - buttons
|
[ 12.0, 20.0, -20.0, 2.0, 8.0, 2.0, 0.0, 0.0, 192, 192, 192, 1, 0, 11, 2, 20.0] // 3 - buttons
|
||||||
|
|
|
@ -7,15 +7,15 @@ Blocks:
|
||||||
[-7.0, 5.0, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
[-7.0, 5.0, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
||||||
[ 5.5, 5.0, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
[ 5.5, 5.0, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
||||||
|
|
||||||
[-3.0, 3.334, -8.5, 6.0, 1.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
[-3.0, 2.0, -8.5, 6.0, 2.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
||||||
[-3.0, 3.334, 7.0, 6.0, 1.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
[-3.0, 2.0, 7.0, 6.0, 2.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
||||||
[-8.5, 3.334, -3.0, 1.5, 1.0, 6.0, 0.0, 0.0, 128, 128, 128]
|
[-8.5, 2.0, -3.0, 1.5, 2.0, 6.0, 0.0, 0.0, 128, 128, 128]
|
||||||
[ 7.0, 3.334, -3.0, 1.5, 1.0, 6.0, 0.0, 0.0, 128, 128, 128]
|
[ 7.0, 2.0, -3.0, 1.5, 2.0, 6.0, 0.0, 0.0, 128, 128, 128]
|
||||||
|
|
||||||
[-7.0, 1.667, -8.5, 14.0, 1.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
[-7.0, 0.0, -8.5, 14.0, 2.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
||||||
[-7.0, 1.667, 7.0, 14.0, 1.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
[-7.0, 0.0, 7.0, 14.0, 2.0, 1.5, 0.0, 0.0, 128, 128, 128]
|
||||||
[-8.5, 1.667, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
[-8.5, 0.0, -7.0, 1.5, 2.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
||||||
[ 7.0, 1.667, -7.0, 1.5, 1.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
[ 7.0, 0.0, -7.0, 1.5, 2.0, 14.0, 0.0, 0.0, 128, 128, 128]
|
||||||
|
|
||||||
Entities:
|
Entities:
|
||||||
|
|
||||||
|
|
BIN
obj/entities.o
BIN
obj/entities.o
Binary file not shown.
BIN
obj/generation.o
BIN
obj/generation.o
Binary file not shown.
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
|
@ -125,9 +125,12 @@ void speen3(double x, double y, double z, double w, double h, double d, double h
|
||||||
// metai{2} = frequency divider
|
// metai{2} = frequency divider
|
||||||
// metai{3} = phase
|
// metai{3} = phase
|
||||||
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(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) {
|
||||||
|
bool canMove = (ent->metai5 == -1) || xor(buttonSwitch[ent->metai5], (bool)ent->metai4);
|
||||||
|
if(canMove) {
|
||||||
ret->x = ent->metad1 + ent->metad4*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
ret->x = ent->metad1 + ent->metad4*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
||||||
ret->y = ent->metad2 + ent->metad5*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
ret->y = ent->metad2 + ent->metad5*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
||||||
ret->z = ent->metad3 + ent->metad6*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
ret->z = ent->metad3 + ent->metad6*cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0));
|
||||||
|
}
|
||||||
//printf("%lf %lf %lf\n", ret->x, ret->y, ret->z);
|
//printf("%lf %lf %lf\n", ret->x, ret->y, ret->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,10 +141,8 @@ void moving_xyz(double x, double y, double z, double w, double h, double d, doub
|
||||||
// metai{2} = y_side (+/- 1)
|
// metai{2} = y_side (+/- 1)
|
||||||
// metai{3} = z_side (+/- 1)
|
// metai{3} = z_side (+/- 1)
|
||||||
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 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) {
|
||||||
//printf("%lf %lf %lf", ent->metad7, ent->metad8, ent->metad9);
|
bool canMove = (ent->metai5 == -1) || xor(buttonSwitch[ent->metai5], (bool)ent->metai4);
|
||||||
//printf("| %lf %lf %lf\n\n", ent->metad4, ent->metad5, ent->metad6);
|
if(canMove) {
|
||||||
//printf("%lf %lf %lf -> (%lf %lf %lf)\n", x, y, z, (ent->metai1)*ent->metad4*dtime, (ent->metai2)*ent->metad5*dtime, (ent->metai3)*ent->metad6*dtime);
|
|
||||||
//printf("(%d %lf) (%d %lf) (%d %lf)\n\n", (ent->metai1), ent->metad4, (ent->metai2), ent->metad5, (ent->metai3), ent->metad6);
|
|
||||||
ret->x += (ent->metai1)*ent->metad4*dtime;
|
ret->x += (ent->metai1)*ent->metad4*dtime;
|
||||||
if(absf(ent->metad1 - ret->x) > ent->metad7) {
|
if(absf(ent->metad1 - ret->x) > ent->metad7) {
|
||||||
//printf("-x-\n");
|
//printf("-x-\n");
|
||||||
|
@ -162,6 +163,7 @@ void moving_xyz_line(double x, double y, double z, double w, double h, double d,
|
||||||
ent->metai3 *= (-1);
|
ent->metai3 *= (-1);
|
||||||
ret->z += (ent->metai3)*ent->metad6*dtime;
|
ret->z += (ent->metai3)*ent->metad6*dtime;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,6 +288,8 @@ void money(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
||||||
|
bool canMove = (ent->metai5 == -1) || xor(buttonSwitch[ent->metai5], (bool)ent->metai4);
|
||||||
|
if(canMove) {
|
||||||
double dx = ent->metad4*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
double dx = ent->metad4*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
||||||
double dy = ent->metad5*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
double dy = ent->metad5*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
||||||
double dz = ent->metad6*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
double dz = ent->metad6*(cos((double)(ent->metai1*(sim_time+(double)dtime)/ent->metai2 + ent->metai3*3.14159/180.0))-cos((double)(ent->metai1*sim_time/ent->metai2 + ent->metai3*3.14159/180.0)));
|
||||||
|
@ -295,9 +299,12 @@ void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
||||||
camvx += dx/(dtime);
|
camvx += dx/(dtime);
|
||||||
camvy += dy/(dtime);
|
camvy += dy/(dtime);
|
||||||
camvz += dz/(dtime);
|
camvz += dz/(dtime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void translatePlayerLine(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
void translatePlayerLine(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) {
|
||||||
|
bool canMove = (ent->metai5 == -1) || xor(buttonSwitch[ent->metai5], (bool)ent->metai4);
|
||||||
|
if(canMove) {
|
||||||
double dx = (ent->metai1)*ent->metad4*dtime;
|
double dx = (ent->metai1)*ent->metad4*dtime;
|
||||||
double dy = (ent->metai2)*ent->metad5*dtime;
|
double dy = (ent->metai2)*ent->metad5*dtime;
|
||||||
double dz = (ent->metai3)*ent->metad6*dtime;
|
double dz = (ent->metai3)*ent->metad6*dtime;
|
||||||
|
@ -306,7 +313,7 @@ void translatePlayerLine(float dtime, int* hp, int* dmg, entity* ent, cube_0* re
|
||||||
//fz += dz/(dtime*dtime);
|
//fz += dz/(dtime*dtime);
|
||||||
camvx += dx/(dtime);
|
camvx += dx/(dtime);
|
||||||
camvy += dy/(dtime);
|
camvy += dy/(dtime);
|
||||||
camvz += dz/(dtime);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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) {
|
||||||
|
|
|
@ -323,6 +323,15 @@ void get_number_blocks(int* ret_cubes, int* ret_tps, int* ret_ent, FILE* ptr) {
|
||||||
fclose(ptr);
|
fclose(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool exists_optionnal(FILE* ptr, char opener, char closer) {
|
||||||
|
char c = fgetc(ptr);
|
||||||
|
while(c != EOF && c != opener && c != closer) {
|
||||||
|
c = fgetc(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (c == opener);
|
||||||
|
}
|
||||||
|
|
||||||
void align_to(FILE* ptr, char ch) {
|
void align_to(FILE* ptr, char ch) {
|
||||||
char c = fgetc(ptr);
|
char c = fgetc(ptr);
|
||||||
while(c != EOF && c != ch) {
|
while(c != EOF && c != ch) {
|
||||||
|
@ -407,8 +416,13 @@ void parse_one_room(int id, char* filename) {
|
||||||
printf("2/3...\n");
|
printf("2/3...\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
bool doAlign = true;
|
||||||
for(int k = 0; k < nent; k++) {
|
for(int k = 0; k < nent; k++) {
|
||||||
|
if(doAlign) {
|
||||||
align_to(ptr, '[');
|
align_to(ptr, '[');
|
||||||
|
} else {
|
||||||
|
doAlign = true;
|
||||||
|
}
|
||||||
double cx = read_float(ptr);
|
double cx = read_float(ptr);
|
||||||
double cy = read_float(ptr);
|
double cy = read_float(ptr);
|
||||||
double cz = read_float(ptr);
|
double cz = read_float(ptr);
|
||||||
|
@ -494,6 +508,16 @@ void parse_one_room(int id, char* filename) {
|
||||||
int mult = read_int(ptr);
|
int mult = read_int(ptr);
|
||||||
int divd = read_int(ptr);
|
int divd = read_int(ptr);
|
||||||
int phase = read_int(ptr);
|
int phase = read_int(ptr);
|
||||||
|
|
||||||
|
int defaultTrigger = -1;
|
||||||
|
int onHitButton = -1;
|
||||||
|
|
||||||
|
doAlign = exists_optionnal(ptr, '{', '\n');
|
||||||
|
if(doAlign) {
|
||||||
|
defaultTrigger = read_int(ptr);
|
||||||
|
onHitButton = read_int(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
pool[id].area->ents[k]->metad1 = cx;
|
pool[id].area->ents[k]->metad1 = cx;
|
||||||
pool[id].area->ents[k]->metad2 = cy;
|
pool[id].area->ents[k]->metad2 = cy;
|
||||||
pool[id].area->ents[k]->metad3 = cz;
|
pool[id].area->ents[k]->metad3 = cz;
|
||||||
|
@ -503,6 +527,9 @@ void parse_one_room(int id, char* filename) {
|
||||||
pool[id].area->ents[k]->metai1 = mult;
|
pool[id].area->ents[k]->metai1 = mult;
|
||||||
pool[id].area->ents[k]->metai2 = divd;
|
pool[id].area->ents[k]->metai2 = divd;
|
||||||
pool[id].area->ents[k]->metai3 = phase;
|
pool[id].area->ents[k]->metai3 = phase;
|
||||||
|
|
||||||
|
pool[id].area->ents[k]->metai4 = defaultTrigger;
|
||||||
|
pool[id].area->ents[k]->metai5 = onHitButton;
|
||||||
} else if(entry->id == 5) {
|
} else if(entry->id == 5) {
|
||||||
// linear platform
|
// linear platform
|
||||||
double amp_x = read_float(ptr);
|
double amp_x = read_float(ptr);
|
||||||
|
@ -511,6 +538,16 @@ void parse_one_room(int id, char* filename) {
|
||||||
double speed_x = read_float(ptr);
|
double speed_x = read_float(ptr);
|
||||||
double speed_y = read_float(ptr);
|
double speed_y = read_float(ptr);
|
||||||
double speed_z = read_float(ptr);
|
double speed_z = read_float(ptr);
|
||||||
|
|
||||||
|
int defaultTrigger = -1;
|
||||||
|
int onHitButton = -1;
|
||||||
|
|
||||||
|
doAlign = exists_optionnal(ptr, '{', '\n');
|
||||||
|
if(doAlign) {
|
||||||
|
defaultTrigger = read_int(ptr);
|
||||||
|
onHitButton = read_int(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
printf("%lf %lf %lf %lf %lf %lf\n", amp_x, amp_y, amp_z, speed_x, speed_y, speed_z);
|
printf("%lf %lf %lf %lf %lf %lf\n", amp_x, amp_y, amp_z, speed_x, speed_y, speed_z);
|
||||||
pool[id].area->ents[k]->metad1 = cx;
|
pool[id].area->ents[k]->metad1 = cx;
|
||||||
pool[id].area->ents[k]->metad2 = cy;
|
pool[id].area->ents[k]->metad2 = cy;
|
||||||
|
@ -524,6 +561,9 @@ void parse_one_room(int id, char* filename) {
|
||||||
pool[id].area->ents[k]->metai1 = 1;
|
pool[id].area->ents[k]->metai1 = 1;
|
||||||
pool[id].area->ents[k]->metai2 = 1;
|
pool[id].area->ents[k]->metai2 = 1;
|
||||||
pool[id].area->ents[k]->metai3 = 1;
|
pool[id].area->ents[k]->metai3 = 1;
|
||||||
|
|
||||||
|
pool[id].area->ents[k]->metai4 = defaultTrigger;
|
||||||
|
pool[id].area->ents[k]->metai5 = onHitButton;
|
||||||
} else if(entry->id == 6) {
|
} else if(entry->id == 6) {
|
||||||
// text box
|
// text box
|
||||||
char* msg = read_string(ptr);
|
char* msg = read_string(ptr);
|
||||||
|
|
|
@ -299,7 +299,8 @@ void processInput(GLFWwindow *window, float dtime) {
|
||||||
hardReset = false;
|
hardReset = false;
|
||||||
//reset_everything(window, 4, "levels/level_00/");
|
//reset_everything(window, 4, "levels/level_00/");
|
||||||
//reset_everything(window, 7, "levels/level_01/");
|
//reset_everything(window, 7, "levels/level_01/");
|
||||||
reset_everything(window, 1, "levels/level_03/");
|
reset_everything(window, 1, "levels/level_02/");
|
||||||
|
//reset_everything(window, 1, "levels/level_03/");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rPress = false;
|
rPress = false;
|
||||||
|
|
|
@ -356,9 +356,9 @@ bool is_colliding(float dtime) {
|
||||||
for(int k = 0; k < vstd->ent_len; k++) {
|
for(int k = 0; k < vstd->ent_len; k++) {
|
||||||
//printf("%d -> %d\n", k, vstd->ents[k]->entity_type);
|
//printf("%d -> %d\n", k, vstd->ents[k]->entity_type);
|
||||||
if(
|
if(
|
||||||
(vstd->ents[k]->entity_type != 12 || xor(buttonSwitch[vstd->ents[k]->metai1], vstd->ents[k]->metai2)) &&
|
(vstd->ents[k]->entity_type != 12 || xor(buttonSwitch[vstd->ents[k]->metai1], vstd->ents[k]->metai2)) && // disabled button block
|
||||||
(vstd->ents[k]->entity_type != 9 || vstd->ents[k]->metai1) &&
|
(vstd->ents[k]->entity_type != 9 || vstd->ents[k]->metai1) && // off-beat block
|
||||||
(vstd->ents[k]->entity_type != 13 || (vstd->ents[k]->metad1 == 0.0 || vstd->ents[k]->metai1 == 0))
|
(vstd->ents[k]->entity_type != 13 || (vstd->ents[k]->metad1 == 0.0 || vstd->ents[k]->metai1 == 0)) // hollow math block
|
||||||
) {
|
) {
|
||||||
double dist = distance_pt_cube_0_3d_infinite(camx-2*room_width*w, camy, camz-2*room_depth*h, vstd->ents[k]->pos);
|
double dist = distance_pt_cube_0_3d_infinite(camx-2*room_width*w, camy, camz-2*room_depth*h, vstd->ents[k]->pos);
|
||||||
//printf("%lf vs %lf\n", dist, min_dist);
|
//printf("%lf vs %lf\n", dist, min_dist);
|
||||||
|
|
Loading…
Reference in New Issue