Compare commits
6 Commits
9827865e9c
...
v1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a5a79dc60 | |||
| baae73a38d | |||
| ec7ac7114e | |||
| cabbb52cbb | |||
| ac4e1f3298 | |||
| b292ae710a |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -4,4 +4,7 @@
|
||||
*.dSYM/*
|
||||
build/*
|
||||
thepool
|
||||
thepool_debug
|
||||
thepool_debug
|
||||
valgrind*
|
||||
release/*
|
||||
data.jf2
|
||||
|
||||
BIN
data/doors.gif
BIN
data/doors.gif
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -24,6 +24,8 @@ obrer.gif
|
||||
piscina.gif
|
||||
prologo1.gif
|
||||
prologo2.gif
|
||||
prologo3.gif
|
||||
prologo4.gif
|
||||
roomaux.gif
|
||||
sam.gif
|
||||
test.gif
|
||||
|
||||
BIN
data/prologo3.gif
Normal file
BIN
data/prologo3.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
data/prologo4.gif
Normal file
BIN
data/prologo4.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,7 +1,7 @@
|
||||
width: 2
|
||||
height: 3
|
||||
door-height-xn: 3
|
||||
door-height-yp: 2
|
||||
door-height-yp: 3
|
||||
color: WHITE
|
||||
floor-texture: 11
|
||||
wall-texture: 2
|
||||
|
||||
@@ -37,6 +37,17 @@ actor{
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: ARCADE
|
||||
bmp: altres.gif
|
||||
bmp-rect: 160 0 30 48
|
||||
bmp-offset: 0 49
|
||||
pos: 56 8 0
|
||||
size: 8 8 16
|
||||
orient: YP
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BATMAN
|
||||
bmp: batman.gif
|
||||
@@ -67,7 +78,7 @@ actor{
|
||||
bmp: altres.gif
|
||||
bmp-rect: 128 0 20 41
|
||||
bmp-offset: -6 45
|
||||
pos: 56 8 0
|
||||
pos: 16 8 0
|
||||
size: 6 6 16
|
||||
movement: CW
|
||||
}
|
||||
|
||||
@@ -11,6 +11,19 @@ exit-xp: 17
|
||||
exit-xn: 28
|
||||
editor-done: 1
|
||||
|
||||
actor{
|
||||
name: B-03-GOD
|
||||
bmp: objectes.gif
|
||||
bmp-rect: 114 78 15 18
|
||||
bmp-offset: -8 22
|
||||
pos: 48 -3 16
|
||||
size: 4 4 4
|
||||
anim-cycle: SEQ
|
||||
anim-wait: 2
|
||||
flags: ANIMATED SPECIAL
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX-B
|
||||
bmp: caixes.gif
|
||||
|
||||
@@ -21,6 +21,18 @@ actor{
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: ARCADE
|
||||
bmp: altres.gif
|
||||
bmp-rect: 160 0 30 48
|
||||
bmp-offset: 0 49
|
||||
pos: 8 24 0
|
||||
size: 8 8 16
|
||||
orient: YP
|
||||
flags: ORIENTABLE
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: CADIRA
|
||||
bmp: caixes.gif
|
||||
|
||||
@@ -27,6 +27,19 @@ actor{
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: B-02-RUN
|
||||
bmp: objectes.gif
|
||||
bmp-rect: 114 78 15 18
|
||||
bmp-offset: -8 22
|
||||
pos: 8 8 0
|
||||
size: 4 4 4
|
||||
anim-cycle: SEQ
|
||||
anim-wait: 2
|
||||
flags: ANIMATED SPECIAL
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BATMAN
|
||||
bmp: batman.gif
|
||||
|
||||
@@ -25,7 +25,7 @@ actor{
|
||||
bmp: altres.gif
|
||||
bmp-rect: 0 133 32 27
|
||||
bmp-offset: 0 27
|
||||
pos: 0 48 0
|
||||
pos: 0 51 0
|
||||
size: 8 8 6
|
||||
flags: REACTIVE DEADLY
|
||||
react-mask: XP XN YP YN ZP ZN
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
width: 2
|
||||
height: 3
|
||||
door-height-xn: 3
|
||||
door-height-yp: 2
|
||||
door-height-yp: 3
|
||||
color: WHITE
|
||||
floor-texture: 11
|
||||
wall-texture: 2
|
||||
|
||||
@@ -273,6 +273,18 @@ category{
|
||||
movement: CCW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: ARCADE
|
||||
bmp: altres.gif
|
||||
bmp-rect: 160 0 30 48
|
||||
bmp-offset: 0 49
|
||||
pos: 0 16 0
|
||||
size: 8 8 16
|
||||
orient: YP
|
||||
flags: ORIENTABLE
|
||||
movement: CW
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
category{
|
||||
|
||||
180
source/actor.cpp
180
source/actor.cpp
@@ -33,6 +33,7 @@ namespace actor
|
||||
|
||||
int walk_channel = -1;
|
||||
bool push_sound_already_playing = false;
|
||||
std::vector<actor_t*> purgatory;
|
||||
|
||||
void resetTag()
|
||||
{
|
||||
@@ -69,6 +70,7 @@ namespace actor
|
||||
act->surface = draw::getSurface(bmp.c_str());
|
||||
act->bmp_rect = r;
|
||||
act->bmp_offset = o;
|
||||
act->alive = true;
|
||||
return act;
|
||||
}
|
||||
|
||||
@@ -89,6 +91,8 @@ namespace actor
|
||||
act->react_mask = act->react_push = 0;
|
||||
act->flags = FLAG_NONE;
|
||||
act->template_category = 0;
|
||||
act->alive = true;
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
@@ -233,7 +237,7 @@ namespace actor
|
||||
newactor->prev = act->prev;
|
||||
newactor->next = act->next;
|
||||
act->prev = act->next = nullptr;
|
||||
remove(act);
|
||||
sendToPurgatory(act);
|
||||
return newactor;
|
||||
}
|
||||
|
||||
@@ -457,13 +461,33 @@ namespace actor
|
||||
actor_t *hero = find("HERO");
|
||||
while (obj2)
|
||||
{
|
||||
if (obj2 != hero && obj1 != obj2 && check_2d_collision(obj1, obj2))
|
||||
if (obj2 != hero && obj1 != obj2 && (obj1->pos.z<obj2->pos.z+obj2->size.z) && check_2d_collision(obj1, obj2))
|
||||
return true;
|
||||
obj2 = obj2->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void find_non_colliding_position(actor_t *obj)
|
||||
{
|
||||
int dist = 1;
|
||||
while (does_collide(obj))
|
||||
{
|
||||
obj->pos.x += dist;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.x -= dist*2;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.x += dist;
|
||||
obj->pos.y += dist;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.y -= dist*2;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.y += dist;
|
||||
dist++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const bool is_above(actor_t *obj1, actor_t *obj2)
|
||||
{
|
||||
return check_2d_collision(obj1, obj2) && (obj1->pos.z == obj2->pos.z + obj2->size.z);
|
||||
@@ -636,6 +660,7 @@ namespace actor
|
||||
audio::playSound("snd_disappear.wav", SOUND_BASIC);
|
||||
act = actor::replaceWithTemplate(act, "EXPLOSION");
|
||||
act->name[0] = '_';
|
||||
return PUSH_NONE;
|
||||
}
|
||||
|
||||
if (source->flags & FLAG_DEADLY)
|
||||
@@ -712,6 +737,7 @@ namespace actor
|
||||
act = actor::replaceWithTemplate(act, "EXPLOSION");
|
||||
act->name[0] = '_';
|
||||
room::cycleColor(1);
|
||||
return PUSH_NONE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -730,6 +756,7 @@ namespace actor
|
||||
if ((act->pos.x > min.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XN) && (act->pos.y >= 24) && (act->pos.y <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if ((act->pos.x <= min.x) && (act->pos.z == room::getDoor(XN) * 4) && (room::getDoors() & DOOR_XN))
|
||||
{
|
||||
if (act->pos.y < 28)
|
||||
@@ -737,10 +764,16 @@ namespace actor
|
||||
else if (act->pos.y > 28)
|
||||
act->push |= PUSH_YN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_RIGHT)) //(input::keyDown(SDL_SCANCODE_RIGHT) || input::keyDown(config::getKey(KEY_RIGHT)))
|
||||
@@ -750,6 +783,7 @@ namespace actor
|
||||
if (((act->pos.x + act->size.x) < max.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if (((act->pos.x + act->size.x) >= max.x) && (act->pos.z == room::getDoor(XP) * 4) && (room::getDoors() & DOOR_XP))
|
||||
{
|
||||
if (act->pos.y < 28)
|
||||
@@ -757,10 +791,16 @@ namespace actor
|
||||
else if (act->pos.y > 28)
|
||||
act->push |= PUSH_YN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_UP)) // input::keyDown(SDL_SCANCODE_UP) || input::keyDown(config::getKey(KEY_UP)))
|
||||
@@ -770,6 +810,7 @@ namespace actor
|
||||
if ((act->pos.y > min.y && act->pos.x >= min.x && (act->pos.x + act->size.x) <= max.x) || ((room::getDoors() & DOOR_YN) && (act->pos.x >= 24) && (act->pos.x <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if ((act->pos.y <= min.y) && (act->pos.z == room::getDoor(YN) * 4) && (room::getDoors() & DOOR_YN))
|
||||
{
|
||||
if (act->pos.x < 28)
|
||||
@@ -777,10 +818,16 @@ namespace actor
|
||||
else if (act->pos.x > 28)
|
||||
act->push |= PUSH_XN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_DOWN)) // input::keyDown(SDL_SCANCODE_DOWN) || input::keyDown(config::getKey(KEY_DOWN)))
|
||||
@@ -790,6 +837,7 @@ namespace actor
|
||||
if (((act->pos.y + act->size.y) < max.y && act->pos.x >= min.x && (act->pos.x + act->size.x) <= max.x) || ((room::getDoors() & DOOR_YP) && (act->pos.x >= 24) && (act->pos.x <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if (((act->pos.y + act->size.y) >= max.y) && (act->pos.z == room::getDoor(YP) * 4) && (room::getDoors() & DOOR_YP))
|
||||
{
|
||||
if (act->pos.x < 28)
|
||||
@@ -797,10 +845,16 @@ namespace actor
|
||||
else if (act->pos.x > 28)
|
||||
act->push |= PUSH_XN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ((input::keyPressed(SDL_SCANCODE_RETURN) || input::keyPressed(config::getKey(KEY_PICK))) && (hero::getSkills() & SKILL_PANTS))
|
||||
@@ -815,7 +869,8 @@ namespace actor
|
||||
if (picked->pos.y + picked->size.y > room::getMax().y)
|
||||
picked->pos.y = room::getMax().y - picked->size.y;
|
||||
picked->pos.z = act->pos.z;
|
||||
if (does_collide(picked))
|
||||
find_non_colliding_position(picked);
|
||||
/*if (does_collide(picked))
|
||||
{
|
||||
picked->pos.x -= 2;
|
||||
if (does_collide(picked))
|
||||
@@ -823,7 +878,7 @@ namespace actor
|
||||
picked->pos.x += 2;
|
||||
picked->pos.y -= 2;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
act->pos.z += picked->size.z;
|
||||
actor::actor_t *above = act->above;
|
||||
while (above)
|
||||
@@ -1056,7 +1111,7 @@ namespace actor
|
||||
vec3_t min = room::getMin();
|
||||
vec3_t max = room::getMax();
|
||||
|
||||
if ((act->push & PUSH_KILL) && (act->flags & FLAG_HERO))
|
||||
if ((act->push & PUSH_KILL) && (act->flags & FLAG_HERO) && (!hero::hasBoostGod()))
|
||||
{
|
||||
if (!editor::isDevMode())
|
||||
{
|
||||
@@ -1085,6 +1140,8 @@ namespace actor
|
||||
return;
|
||||
}
|
||||
|
||||
if ((act->flags & FLAG_HERO) && (hero::hasBoostGod())) act->push &= ~PUSH_KILL;
|
||||
|
||||
// [RZC 26/09/2024] Hack usant react_push en el moviment RAND per a contar la distancia abans de canviar de direcció
|
||||
if (act->movement == MOV_RAND)
|
||||
{
|
||||
@@ -1103,7 +1160,9 @@ namespace actor
|
||||
act->pos.z += act->react_push;
|
||||
}
|
||||
|
||||
int vel = (act->flags & FLAG_HERO) && (hero::getBoostRun() > 0) ? 2 : 1;
|
||||
//int vel = (act->flags & FLAG_HERO) && (hero::getBoostRun() > 0) ? 2 : 1;
|
||||
int vel = (act->flags & FLAG_HERO) && (act->push & PUSH_DOUBLE) ? 2 : 1;
|
||||
act->push &= ~ PUSH_DOUBLE;
|
||||
|
||||
if (act->push & PUSH_ZP)
|
||||
{
|
||||
@@ -1164,8 +1223,10 @@ namespace actor
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || (act->pos.x < min.x && (!(room::getDoors() & DOOR_XN) || (act->pos.y != 28) || (act->pos.z != room::getDoor(XN) * 4) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other)
|
||||
other->push |= push(act, other, PUSH_XN);
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_XN);
|
||||
if (push_value) other->push |= push_value;
|
||||
}
|
||||
act->pos.x += vel;
|
||||
if (act->flags & FLAG_MOVING)
|
||||
changeMoving(act);
|
||||
@@ -1202,8 +1263,10 @@ namespace actor
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other)
|
||||
other->push |= push(act, other, PUSH_XP);
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_XP);
|
||||
if (push_value) other->push |= push_value;
|
||||
}
|
||||
act->pos.x -= vel;
|
||||
if (act->flags & FLAG_MOVING)
|
||||
changeMoving(act);
|
||||
@@ -1223,7 +1286,7 @@ namespace actor
|
||||
room::load(room::getExit(XP));
|
||||
if (llevar_abad)
|
||||
{
|
||||
actor::remove(actor::find("ABAD"));
|
||||
actor::sendToPurgatory(actor::find("ABAD"));
|
||||
}
|
||||
act->pos.x = room::getMin().x - 3;
|
||||
act->pos.z = room::getDoor(XN) * 4;
|
||||
@@ -1243,8 +1306,10 @@ namespace actor
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || (act->pos.y < min.y && (!(room::getDoors() & DOOR_YN) || (act->pos.x != 28) || (act->pos.z != room::getDoor(YN) * 4) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other)
|
||||
other->push |= push(act, other, PUSH_YN);
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_YN);
|
||||
if (push_value) other->push |= push_value;
|
||||
}
|
||||
act->pos.y += vel;
|
||||
if (act->flags & FLAG_MOVING)
|
||||
changeMoving(act);
|
||||
@@ -1279,8 +1344,10 @@ namespace actor
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || !(act->flags & FLAG_HERO))))
|
||||
{
|
||||
if (other)
|
||||
other->push |= push(act, other, PUSH_YP);
|
||||
if (other) {
|
||||
uint8_t push_value = push(act, other, PUSH_YP);
|
||||
if (push_value) other->push |= push_value;
|
||||
}
|
||||
act->pos.y -= vel;
|
||||
if (act->flags & FLAG_MOVING)
|
||||
changeMoving(act);
|
||||
@@ -1337,7 +1404,8 @@ namespace actor
|
||||
if (is_above(act, act->below))
|
||||
{
|
||||
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
|
||||
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||
uint8_t push_value = push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||
if (push_value) act->push |= push_value;
|
||||
act->push &= ~PUSH_ZN;
|
||||
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
|
||||
changeMoving(act);
|
||||
@@ -1358,7 +1426,9 @@ namespace actor
|
||||
act->below = below;
|
||||
below->above = act;
|
||||
// ... i li passem el push, netejem el meu flag i gonnem
|
||||
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||
uint8_t push_value = push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||
if (push_value) act->push |= push_value;
|
||||
|
||||
act->push &= ~PUSH_ZN;
|
||||
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
|
||||
changeMoving(act);
|
||||
@@ -1414,7 +1484,7 @@ namespace actor
|
||||
{
|
||||
if (act->name[0] == '_')
|
||||
{
|
||||
actor::remove(act);
|
||||
actor::sendToPurgatory(act);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -1431,23 +1501,16 @@ namespace actor
|
||||
act->anim_wait_count++;
|
||||
}
|
||||
|
||||
if (act->flags & FLAG_HERO)
|
||||
updateUserInput(act);
|
||||
if (act->flags & FLAG_HERO) updateUserInput(act);
|
||||
if (act->flags & FLAG_MOVING)
|
||||
{
|
||||
if (act->movement == MOV_HUNT && ((act->pos.x & 7) == 0 || (act->pos.y & 7) == 0))
|
||||
changeMoving(act);
|
||||
updateMoving(act);
|
||||
}
|
||||
if (act->flags & FLAG_GRAVITY)
|
||||
act->push |= PUSH_ZN;
|
||||
if (act->flags & FLAG_GRAVITY) act->push |= PUSH_ZN;
|
||||
|
||||
// if (act->flags & FLAG_PUSHABLE)
|
||||
updatePush(act);
|
||||
// if (act->flags & FLAG_GRAVITY) updateGravity(act);
|
||||
// if (act->flags & FLAG_REACTIVE) updateReactive(act);
|
||||
|
||||
// act->push = PUSH_NONE;
|
||||
|
||||
if (!room_changed && update_all && next)
|
||||
update(next);
|
||||
@@ -1666,6 +1729,26 @@ namespace actor
|
||||
free(act);
|
||||
}
|
||||
|
||||
void sendToPurgatory(actor_t *act)
|
||||
{
|
||||
if (!act) return;
|
||||
if (act->prev) act->prev->next = act->next;
|
||||
if (act == first) first = act->next;
|
||||
if (act == dirty) dirty = act->next;
|
||||
if (act->next) act->next->prev = act->prev;
|
||||
if (act == selected) selected = nullptr;
|
||||
if (act->below) act->below->above = nullptr;
|
||||
if (act->above) act->above->below = nullptr;
|
||||
act->alive = false;
|
||||
purgatory.push_back(act);
|
||||
}
|
||||
|
||||
void cleanPurgatory()
|
||||
{
|
||||
for (auto act : purgatory) remove(act);
|
||||
purgatory.clear();
|
||||
}
|
||||
|
||||
void pick(actor_t *act)
|
||||
{
|
||||
if (!act)
|
||||
@@ -1949,6 +2032,7 @@ namespace actor
|
||||
bool dead = false;
|
||||
bool prologo = false;
|
||||
int prologo_objects[4] = {PROLOGO_OBJECT_INITIAL, PROLOGO_OBJECT_INITIAL, PROLOGO_OBJECT_INITIAL, PROLOGO_OBJECT_INITIAL};
|
||||
int num_prologo_objects=0;
|
||||
|
||||
void setPrologo(const bool value)
|
||||
{
|
||||
@@ -1984,6 +2068,7 @@ namespace actor
|
||||
skills = SKILL_NONE;
|
||||
if (prologo) skills &= SKILL_SHOES;
|
||||
for (int i=0;i<4;++i) prologo_objects[i] = PROLOGO_OBJECT_INITIAL;
|
||||
num_prologo_objects=0;
|
||||
parts = PART_NONE;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
anbernics[i] = false;
|
||||
@@ -2022,8 +2107,8 @@ namespace actor
|
||||
{
|
||||
return dead;
|
||||
}
|
||||
|
||||
const int getBoosterFromString(const char *booster)
|
||||
|
||||
{
|
||||
static const char *boostset_name[4] = {"RUN", "GOD", "JUMP", "LIVE"};
|
||||
for (int i = 0; i < 4; ++i)
|
||||
@@ -2130,6 +2215,11 @@ namespace actor
|
||||
boost_jumps--;
|
||||
}
|
||||
|
||||
const bool hasBoostGod()
|
||||
{
|
||||
return boost_god > 0;
|
||||
}
|
||||
|
||||
const int getSkillFromString(char *skill)
|
||||
{
|
||||
static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
|
||||
@@ -2168,7 +2258,12 @@ namespace actor
|
||||
|
||||
bool giveSkill(char *skill)
|
||||
{
|
||||
return giveSkill(getSkillFromString(skill));
|
||||
const int skill_number = getSkillFromString(skill);
|
||||
if (skill_number==SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!");
|
||||
else if (skill_number==SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!");
|
||||
else if (skill_number==SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!");
|
||||
else if (skill_number==SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!");
|
||||
return giveSkill(skill_number);
|
||||
}
|
||||
|
||||
bool dropSkill(int skill)
|
||||
@@ -2230,8 +2325,13 @@ namespace actor
|
||||
{
|
||||
const int value = getPartFromString(part);
|
||||
parts |= value;
|
||||
if (value != 0)
|
||||
stats::collectPart();
|
||||
if (value != 0) stats::collectPart();
|
||||
|
||||
int num_parts = stats::getNumPartsCollected();
|
||||
char text[] = " PECES ARREPLEGADES:- 0/6";
|
||||
text[34] = num_parts + 48;
|
||||
modules::game::setMissatge(text);
|
||||
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
@@ -2255,6 +2355,18 @@ namespace actor
|
||||
void pickAnbernic(char *name)
|
||||
{
|
||||
anbernics[name[8] - 48] = true;
|
||||
int num_anbernics = getNumAmbernicsCollected();
|
||||
if (num_anbernics==10)
|
||||
{
|
||||
modules::game::setMissatge(" HAS DESBLOQUEJAT- EL PROLOGO!");
|
||||
config::setProgoloDesbloquejat();
|
||||
}
|
||||
else
|
||||
{
|
||||
char text[] = " ANBERNICS ARREPLEGADES:- 0/10";
|
||||
text[36] = num_anbernics+48;
|
||||
modules::game::setMissatge(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool wasAnbernicCollected(char *name)
|
||||
@@ -2279,6 +2391,7 @@ namespace actor
|
||||
void leavePrologoObject(int which)
|
||||
{
|
||||
prologo_objects[which] = PROLOGO_OBJECT_LEFT;
|
||||
num_prologo_objects++;
|
||||
}
|
||||
|
||||
const bool isCarryingPrologoObject()
|
||||
@@ -2292,6 +2405,11 @@ namespace actor
|
||||
return prologo_objects[which];
|
||||
}
|
||||
|
||||
const int getNumPrologoObjectsDone()
|
||||
{
|
||||
return num_prologo_objects;
|
||||
}
|
||||
|
||||
void move(int *x, int *y, int *z)
|
||||
{
|
||||
actor_t *hero = actor::find("HERO");
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define PUSH_ZP 16
|
||||
#define PUSH_ZN 32
|
||||
#define PUSH_KILL 64
|
||||
#define PUSH_DOUBLE 128
|
||||
|
||||
// Tipus de moviment de l'actor
|
||||
#define MOV_NONE 0 // Ningun
|
||||
@@ -109,6 +110,7 @@ namespace actor
|
||||
|
||||
int tag;
|
||||
int template_category;
|
||||
bool alive;
|
||||
};
|
||||
|
||||
void resetTag();
|
||||
@@ -169,6 +171,10 @@ namespace actor
|
||||
|
||||
void remove(actor_t *act);
|
||||
|
||||
void sendToPurgatory(actor_t *act);
|
||||
|
||||
void cleanPurgatory();
|
||||
|
||||
void pick(actor_t *act);
|
||||
|
||||
actor_t *getPicked();
|
||||
@@ -227,6 +233,7 @@ namespace actor
|
||||
void useBoostGod();
|
||||
void useBoostRun();
|
||||
void useBoostJump();
|
||||
const bool hasBoostGod();
|
||||
|
||||
const int getSkillFromString(char *skill);
|
||||
const char *getSkillName(int skill);
|
||||
@@ -252,6 +259,7 @@ namespace actor
|
||||
void leavePrologoObject(int which);
|
||||
const bool isCarryingPrologoObject();
|
||||
const int getPrologoObjectState(int which);
|
||||
const int getNumPrologoObjectsDone();
|
||||
|
||||
void move(int *x, int *y, int *z);
|
||||
void setFirstPos();
|
||||
|
||||
@@ -54,10 +54,10 @@ OFFSET CONTINGUT TAMANY DESCRIPCIÓ
|
||||
25 4 4 tamany del primer axiu
|
||||
29 13 1 tamany de la ruta al primer arxiu
|
||||
30 "data/hola.txt" 13 la ruta al primer arxiu
|
||||
43 16 4 offset al primer arxiu
|
||||
47 4 4 tamany del primer axiu
|
||||
51 13 1 tamany de la ruta al primer arxiu
|
||||
52 "data/adios.txt" 14 la ruta al primer arxiu
|
||||
43 16 4 offset al segon arxiu
|
||||
47 4 4 tamany del segon axiu
|
||||
51 14 1 tamany de la ruta al segon arxiu
|
||||
52 "data/adios.txt" 14 la ruta al segon arxiu
|
||||
|
||||
|
||||
- Es un exemple raro, perque ocupa mes la ruta al arxiu que l'arxiu en si, pero espere que la idea quede clara!
|
||||
@@ -260,6 +260,7 @@ namespace file
|
||||
if (!found)
|
||||
{
|
||||
// [TODO] Donar mes informació de quin recurs no havem trobat
|
||||
printf("Arxiu: %s\n", resourcename.c_str());
|
||||
perror("El recurs no s'ha trobat en l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
72
source/m_end_prologo_sequence.cpp
Normal file
72
source/m_end_prologo_sequence.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "m_intro.h"
|
||||
#include "jgame.h"
|
||||
#include "jdraw.h"
|
||||
#include "jinput.h"
|
||||
#include "jaudio.h"
|
||||
#include "controller.h"
|
||||
#include "config.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "actor.h"
|
||||
|
||||
namespace modules
|
||||
{
|
||||
namespace end_prologo_sequence
|
||||
{
|
||||
int stage = 0;
|
||||
uint32_t time = 0;
|
||||
|
||||
void init()
|
||||
{
|
||||
time = SDL_GetTicks();
|
||||
stage = 0;
|
||||
draw::restorecol(2);
|
||||
draw::cls(2);
|
||||
|
||||
draw::swapcol(1, 7);
|
||||
draw::setSource(draw::getSurface("prologo3.gif"));
|
||||
draw::draw(96, 28, 128, 96, 0, 0);
|
||||
draw::print2("ALE! QUE BON", 13, 17, WHITE, FONT_ZOOM_NONE);
|
||||
draw::print2("TRABAJ HE HECH!", 11, 19, WHITE, FONT_ZOOM_NONE);
|
||||
draw::render();
|
||||
|
||||
if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg");
|
||||
actor::templates::load();
|
||||
}
|
||||
|
||||
const bool shouldGoToNext()
|
||||
{
|
||||
if (SDL_GetTicks()-time < 1000) return false;
|
||||
return (SDL_GetTicks()-time > (stage==15||stage==16?10000:5000)) ||
|
||||
(controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) ||
|
||||
(input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN));
|
||||
}
|
||||
|
||||
bool loop()
|
||||
{
|
||||
if (controller::pressed(KEY_MENU)) return false;
|
||||
|
||||
if (shouldGoToNext())
|
||||
{
|
||||
time = SDL_GetTicks();
|
||||
stage++;
|
||||
if (stage==2) return false;
|
||||
|
||||
switch (stage)
|
||||
{
|
||||
case 1:
|
||||
draw::cls(2);
|
||||
draw::swapcol(1, 8);
|
||||
draw::setSource(draw::getSurface("prologo4.gif"));
|
||||
draw::draw(96, 28, 128, 96, 0, 0);
|
||||
draw::print2("PERO QUE...?", 12, 17, WHITE, FONT_ZOOM_NONE);
|
||||
//draw::render();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
draw::render();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
source/m_end_prologo_sequence.h
Normal file
10
source/m_end_prologo_sequence.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace modules
|
||||
{
|
||||
namespace end_prologo_sequence
|
||||
{
|
||||
void init();
|
||||
bool loop();
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,14 @@ namespace modules
|
||||
actor::actor_t *act = nullptr;
|
||||
const char *actor_names[] = {"JAILDESIGNER", "BATMAN", "ROBIN", "EL ALTRE BATMAN", "EL ABAD", "LA ROOMBA", "EL OBRER", "BAMBOLLA DE CAFE", "EL YONKI", "LA PILOTA", "SAM", "LORD ABAD"};
|
||||
const char *actor_ids[] = {"JAILDES", "GAT-BATMAN", "GAT-ROBIN", "BATMAN", "ABAD", "ROOMBA2", "OBRER", "COFFEE", "YONKI", "PILOTA", "SAM", "LORD-ABAD"};
|
||||
char time_text[7] = " 00:00";
|
||||
|
||||
void init()
|
||||
void init(bool go_direct_to_credits)
|
||||
{
|
||||
stage = go_direct_to_credits ? 2 : 0;
|
||||
time = SDL_GetTicks();
|
||||
if (go_direct_to_credits) time += 5000;
|
||||
|
||||
draw::restorecol(2);
|
||||
draw::cls(2);
|
||||
|
||||
@@ -33,10 +37,24 @@ namespace modules
|
||||
|
||||
if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg");
|
||||
actor::templates::load();
|
||||
|
||||
int milliseconds = SDL_GetTicks()-actor::stats::getStartTime();
|
||||
int seconds = milliseconds/1000;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
|
||||
time_text[0] = minutes<100 ? ' ' : (minutes/100)+48;
|
||||
time_text[1] = minutes<10 ? ' ' : ((minutes%100)/10)+48;
|
||||
time_text[2] = (minutes%10)+48;
|
||||
|
||||
time_text[4] = (seconds/10)+48;
|
||||
time_text[5] = (seconds%10)+48;
|
||||
time_text[6] = 0;
|
||||
}
|
||||
|
||||
const bool shouldGoToNext()
|
||||
{
|
||||
if (SDL_GetTicks()-time < 1000) return false;
|
||||
return (SDL_GetTicks()-time > (stage==15||stage==16?10000:5000)) ||
|
||||
(controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) ||
|
||||
(input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN));
|
||||
@@ -126,7 +144,17 @@ namespace modules
|
||||
}
|
||||
case 16:
|
||||
draw::cls(2);
|
||||
draw::print2("GRACIES PER JUGAR!", 11, 15, PURPLE, FONT_ZOOM_NONE);
|
||||
draw::print2("GRACIES PER JUGAR!", 11, 9, PURPLE, FONT_ZOOM_VERTICAL);
|
||||
|
||||
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE);
|
||||
|
||||
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
|
||||
|
||||
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace modules
|
||||
{
|
||||
namespace end_sequence
|
||||
{
|
||||
void init();
|
||||
void init(bool go_direct_to_credits=false);
|
||||
bool loop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,8 +289,38 @@ namespace modules
|
||||
return section;
|
||||
}
|
||||
|
||||
char missatge[255] = "";
|
||||
|
||||
void mostra_missatge()
|
||||
{
|
||||
if ( (controller::pressed(KEY_MENU)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) )
|
||||
{
|
||||
missatge[0] = 0;
|
||||
return;
|
||||
}
|
||||
draw::color(BLACK);
|
||||
draw::fillrect(56, 68, 208, 48);
|
||||
draw::color(WHITE);
|
||||
draw::rect(56, 68, 208, 48);
|
||||
char text[2][25];
|
||||
int i=0, j=0, k=0;
|
||||
while (missatge[i]!=0)
|
||||
{
|
||||
if (missatge[i]=='-') { text[k][j]=0; i++; j=0; k++; }
|
||||
text[k][j] = missatge[i];
|
||||
i++; j++;
|
||||
}
|
||||
text[k][j]=0;
|
||||
draw::print2(text[0], 8, 10, WHITE, FONT_ZOOM_NONE);
|
||||
draw::print2(text[1], 8, 12, WHITE, FONT_ZOOM_NONE);
|
||||
|
||||
draw::render();
|
||||
}
|
||||
|
||||
int loop()
|
||||
{
|
||||
if (missatge[0] != 0) { mostra_missatge(); return GAME_NONE; }
|
||||
|
||||
int return_value = GAME_NONE;
|
||||
|
||||
if (actor::hero::isDead()) return GAME_DEAD;
|
||||
@@ -325,6 +355,7 @@ namespace modules
|
||||
actor::update(actor::getFirst());
|
||||
actor::hero::useBoostGod();
|
||||
if ( (actor::hero::getParts()==0x3f) && (room::getCurrent()==45) ) return GAME_END;
|
||||
if ( (actor::hero::getNumPrologoObjectsDone()==4) && (room::getCurrent()==64) ) return GAME_PROLOGO_END;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,6 +874,9 @@ namespace modules
|
||||
changed = true;
|
||||
}
|
||||
*/
|
||||
mx = draw::getLocalX(input::mouseX());
|
||||
my = draw::getLocalY(input::mouseY());
|
||||
|
||||
line+=10;
|
||||
ui::label("POS", 2, line, 48, 11);
|
||||
if (input::mouseClk(1) && mx>=2 && mx <=48 && my>=line && my<=line+10) return_value = GAME_EDITOR_BITMAP_POS;
|
||||
@@ -952,5 +986,11 @@ namespace modules
|
||||
return return_value;
|
||||
|
||||
}
|
||||
|
||||
void setMissatge(const char *text)
|
||||
{
|
||||
strcpy(missatge, text);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace modules
|
||||
#define GAME_EDITOR_BITMAP_POS 6
|
||||
#define GAME_EDITOR_BITMAP_SIZE 7
|
||||
#define GAME_END 8
|
||||
#define GAME_PROLOGO_END 9
|
||||
|
||||
enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR };
|
||||
|
||||
@@ -26,5 +27,7 @@ namespace modules
|
||||
const int getSection();
|
||||
|
||||
std::vector<std::string> getGifs();
|
||||
|
||||
void setMissatge(const char *text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "m_editor_bitmap.h"
|
||||
#include "m_end_sequence.h"
|
||||
#include "m_prologo_intro.h"
|
||||
#include "m_end_prologo_sequence.h"
|
||||
|
||||
#define M_LOGO 0
|
||||
#define M_INTRO 1
|
||||
@@ -47,6 +48,7 @@
|
||||
#define M_EDITOR_BITMAP 14
|
||||
#define M_END 15
|
||||
#define M_PROLOGO_INTRO 16
|
||||
#define M_PROLOGO_END 17
|
||||
|
||||
|
||||
int current_module = M_LOGO;
|
||||
@@ -157,6 +159,9 @@ bool game::loop()
|
||||
case M_END:
|
||||
if (!modules::end_sequence::loop()) { modules::menu::init(); current_module = M_MENU; }
|
||||
break;
|
||||
case M_PROLOGO_END:
|
||||
if (!modules::end_prologo_sequence::loop()) { modules::end_sequence::init(true); current_module = M_END; }
|
||||
break;
|
||||
case M_MENU:
|
||||
option = modules::menu::loop();
|
||||
if (option != OPTION_NONE) {
|
||||
@@ -195,7 +200,11 @@ bool game::loop()
|
||||
modules::editor_bitmap::init(EDITING_BITMAP_POS); current_module = M_EDITOR_BITMAP;
|
||||
} else if (option==GAME_EDITOR_BITMAP_SIZE) {
|
||||
modules::editor_bitmap::init(EDITING_BITMAP_SIZE); current_module = M_EDITOR_BITMAP;
|
||||
} else if (option==GAME_END) { modules::end_sequence::init(); current_module = M_END; }
|
||||
} else if (option==GAME_END) {
|
||||
modules::end_sequence::init(); current_module = M_END;
|
||||
} else if (option==GAME_PROLOGO_END) {
|
||||
modules::end_prologo_sequence::init(); current_module = M_PROLOGO_END;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user