void s2_explode8( ) { self->s.v.frame = 5; self->s.v.think = ( func_t ) SUB_Remove; self->s.v.nextthink = g_globalvars.time + 0.1; check_water(); }
void s2_explode6( ) { self->s.v.frame = 5; self->s.v.think = ( func_t ) s2_explode7; self->s.v.nextthink = g_globalvars.time + 0.1; check_water(); }
void Player::player_move(Map *map) { Actor::move(map); check_water(map); int input = get_input(); const Tmx::Tileset *tileset = map->get_tileset(0); const Tmx::PropertySet prop = tileset->GetProperties(); // Check if on catapult int catid = prop.GetNumericProperty("catapult"); if (catid && check_below(map, 1, catid, catid) == 0) { if (input & PRESS_RIGHT) { set_vx(get_attribute("move_speed")); } else if (input & PRESS_LEFT) { set_vx(-get_attribute("move_speed")); } set_jump(map, true); } switch(m_action) { case Still: set_vx(0); case Move: // Check for crouch or move if (input & PRESS_DOWN) { set_action(Crouch); } else if (input & PRESS_RIGHT) { animate_move(); set_action(Move); set_vx(get_attribute("move_speed")); } else if (input & PRESS_LEFT) { animate_move(); set_action(Move); set_vx(-get_attribute("move_speed")); } else { set_action(Still); } // Check for jump if (input & PRESS_JUMP) { if (m_jump_ready && m_hit_ground) { if (input & PRESS_RIGHT) { set_vx(get_attribute("move_speed")); } else if (input & PRESS_LEFT) { set_vx(-get_attribute("move_speed")); } set_jump(map, false); } m_jump_ready = false; } else { // Restore jump lock m_jump_ready = true; } Body::move(map); if (get_fall()) { set_action(Fall); } break; case Fall: // Check for change of direction during fall if (input & PRESS_RIGHT) { set_vx(get_attribute("move_speed")); } else if (input & PRESS_LEFT) { set_vx(-get_attribute("move_speed")); } Body::move(map); if (!get_fall()) { m_hit_ground = true; set_action(Still); } break; case Jump: case Catapult: Body::move(map); if (get_fall()) { set_action(Fall); } break; case Crouch: set_vx(0); Body::move(map); if (!get_fall()) { m_hit_ground = true; } if (!(input & PRESS_DOWN)) { set_action(Still); } break; case Hit: if (m_hit_timer.expired(get_attribute("hit_time"))) { set_vx(0); set_lock_direction(false); reset_hit(); } Body::move(map); break; case HitPerish: animate_perish(); set_speed(0, -get_attribute("move_speed")); Body::move(map); if (m_y < -get_image_height()) { set_solid(true); set_invisible(false); set_action(HitPerished); } break; case Attack: case AttackLow: if (animate_attack()) { reset_attack(); } Body::move(map); if (!get_fall()) { m_hit_ground = true; } break; default: Body::move(map); break; } }
void desert_water_frontiers(int originx, int originy, int w, int h) { /* copied from connect_transport */ // sets the correct TYPE depending on neighbours, => gives the correct tile to display int mask; /* static const short desert_table[16] = { CST_DESERT_0, CST_DESERT_1D, CST_DESERT_1R, CST_DESERT_2RD, CST_DESERT_1L, CST_DESERT_2LD, CST_DESERT_2LR, CST_DESERT_3LRD, CST_DESERT_1U, CST_DESERT_2UD, CST_DESERT_2RU, CST_DESERT_3RUD, CST_DESERT_2LU, CST_DESERT_3LUD, CST_DESERT_3LRU, CST_DESERT }; #if FLAG_LEFT != 1 || FLAG_UP != 2 || FLAG_RIGHT != 4 || FLAG_DOWN != 8 #error desert_frontier(): you loose #error the algorithm depends on proper flag settings -- (ThMO) #endif */ /* Adjust originx,originy,w,h to proper range */ if (originx <= 0) { w -= 1 - originx; originx = 1; } if (originy <= 0) { h -= 1 - originy; originy = 1; } if (originx + w >= world.len()) { w = world.len() - originx;} if (originy + h >= world.len()) { h = world.len() - originy;} for (int x = originx; x < originx + w; x++) { for (int y = originy; y < originy + h; y++) { if ( world(x, y)->getLowerstVisibleGroup() == GROUP_DESERT) { mask = 0; if ( check_lvgroup(x, y - 1) == GROUP_DESERT ) { mask |= 8;} if ( check_lvgroup(x - 1, y) == GROUP_DESERT ) { mask |= 4;} if ( check_lvgroup(x + 1, y) == GROUP_DESERT ) { mask |= 2;} if ( check_lvgroup(x, y + 1) == GROUP_DESERT ) { ++mask;} world(x, y)->type = mask; } else if ( world(x, y)->getLowerstVisibleGroup() == GROUP_WATER) { mask = 0; if ( check_water(x, y - 1) || (check_group(x, y - 1) == GROUP_PORT) ) { mask |= 8;} if ( check_water(x - 1, y) || (check_group(x - 1, y) == GROUP_PORT) ) { mask |= 4;} if ( check_water(x + 1, y) ) { mask |= 2;} if ( check_water(x, y + 1) ) { ++mask;} world(x, y)->type = mask; } } } }