| 1 | /* |
| 2 | * OpenTyrian: A modern cross-platform port of Tyrian |
| 3 | * Copyright (C) 2007-2009 The OpenTyrian Development Team |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | #ifndef PLAYER_H |
| 20 | #define PLAYER_Hcxx . . $ `src/player.h:20:9`! |
| 21 | |
| 22 | #include "config.h"cxx . . $ `<file>/src/config.h`/ |
| 23 | #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/ |
| 24 | |
| 25 | enumcxx . . $ $anonymous_type_55bed0e189d5bed_0# |
| 26 | { |
| 27 | FRONT_WEAPONcxx . . $ FRONT_WEAPON. = 0, |
| 28 | REAR_WEAPONcxx . . $ REAR_WEAPON. = 1 |
| 29 | }; |
| 30 | |
| 31 | enumcxx . . $ $anonymous_type_55bed0e189d5bed_1# |
| 32 | { |
| 33 | LEFT_SIDEKICKcxx . . $ LEFT_SIDEKICK. = 0, |
| 34 | RIGHT_SIDEKICKcxx . . $ RIGHT_SIDEKICK. = 1 |
| 35 | }; |
| 36 | |
| 37 | typedef structcxx . . $ $anonymous_type_55bed0e189d5bed_2# |
| 38 | { |
| 39 | Uint8cxx . . $ Uint8# shipcxx . . $ $anonymous_type_55bed0e189d5bed_2#ship.; |
| 40 | Uint8cxx . . $ Uint8# generatorcxx . . $ $anonymous_type_55bed0e189d5bed_2#generator.; |
| 41 | Uint8cxx . . $ Uint8# shieldcxx . . $ $anonymous_type_55bed0e189d5bed_2#shield.; |
| 42 | structcxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3# |
| 43 | { |
| 44 | Uint8cxx . . $ Uint8# idcxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3#id.; |
| 45 | Uint8cxx . . $ Uint8# powercxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3#power.; |
| 46 | } weaponcxx . . $ $anonymous_type_55bed0e189d5bed_2#weapon.[2]; |
| 47 | Uint8cxx . . $ Uint8# sidekickcxx . . $ $anonymous_type_55bed0e189d5bed_2#sidekick.[2]; |
| 48 | Uint8cxx . . $ Uint8# specialcxx . . $ $anonymous_type_55bed0e189d5bed_2#special.; |
| 49 | |
| 50 | // Dragonwing only: |
| 51 | // repeatedly collecting the same powerup gives a series of sidekick upgrades |
| 52 | Uint8cxx . . $ Uint8# sidekick_seriescxx . . $ $anonymous_type_55bed0e189d5bed_2#sidekick_series.; |
| 53 | Uint8cxx . . $ Uint8# sidekick_levelcxx . . $ $anonymous_type_55bed0e189d5bed_2#sidekick_level.; |
| 54 | |
| 55 | // Single-player only |
| 56 | Uint8cxx . . $ Uint8# super_arcade_modecxx . . $ $anonymous_type_55bed0e189d5bed_2#super_arcade_mode.; // stored as an item for compatibility :( |
| 57 | } |
| 58 | PlayerItemscxx . . $ PlayerItems#; |
| 59 | |
| 60 | typedef structcxx . . $ $anonymous_type_55bed0e189d5bed_4# |
| 61 | { |
| 62 | ulongcxx . . $ ulong# cashcxx . . $ $anonymous_type_55bed0e189d5bed_4#cash.; |
| 63 | |
| 64 | PlayerItemscxx . . $ PlayerItems# itemscxx . . $ $anonymous_type_55bed0e189d5bed_4#items., last_itemscxx . . $ $anonymous_type_55bed0e189d5bed_4#last_items.; |
| 65 | |
| 66 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_dragonwingcxx . . $ $anonymous_type_55bed0e189d5bed_4#is_dragonwing.; // i.e., is player 2 |
| 67 | Uint8cxx . . $ Uint8# *livescxx . . $ $anonymous_type_55bed0e189d5bed_4#lives.; |
| 68 | |
| 69 | // calculatable |
| 70 | uintcxx . . $ uint# shield_maxcxx . . $ $anonymous_type_55bed0e189d5bed_4#shield_max.; |
| 71 | uintcxx . . $ uint# initial_armorcxx . . $ $anonymous_type_55bed0e189d5bed_4#initial_armor.; |
| 72 | uintcxx . . $ uint# shot_hit_area_xcxx . . $ $anonymous_type_55bed0e189d5bed_4#shot_hit_area_x., shot_hit_area_ycxx . . $ $anonymous_type_55bed0e189d5bed_4#shot_hit_area_y.; |
| 73 | |
| 74 | // state |
| 75 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_alivecxx . . $ $anonymous_type_55bed0e189d5bed_4#is_alive.; |
| 76 | uintcxx . . $ uint# invulnerable_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#invulnerable_ticks.; // ticks until ship can be damaged |
| 77 | uintcxx . . $ uint# exploding_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#exploding_ticks.; // ticks until ship done exploding |
| 78 | uintcxx . . $ uint# shieldcxx . . $ $anonymous_type_55bed0e189d5bed_4#shield.; |
| 79 | uintcxx . . $ uint# armorcxx . . $ $anonymous_type_55bed0e189d5bed_4#armor.; |
| 80 | uintcxx . . $ uint# weapon_modecxx . . $ $anonymous_type_55bed0e189d5bed_4#weapon_mode.; |
| 81 | uintcxx . . $ uint# superbombscxx . . $ $anonymous_type_55bed0e189d5bed_4#superbombs.; |
| 82 | uintcxx . . $ uint# purple_balls_neededcxx . . $ $anonymous_type_55bed0e189d5bed_4#purple_balls_needed.; |
| 83 | |
| 84 | int xcxx . . $ $anonymous_type_55bed0e189d5bed_4#x., ycxx . . $ $anonymous_type_55bed0e189d5bed_4#y.; |
| 85 | int old_xcxx . . $ $anonymous_type_55bed0e189d5bed_4#old_x.[20], old_ycxx . . $ $anonymous_type_55bed0e189d5bed_4#old_y.[20]; |
| 86 | |
| 87 | int x_velocitycxx . . $ $anonymous_type_55bed0e189d5bed_4#x_velocity., y_velocitycxx . . $ $anonymous_type_55bed0e189d5bed_4#y_velocity.; |
| 88 | uintcxx . . $ uint# x_friction_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#x_friction_ticks., y_friction_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#y_friction_ticks.; // ticks until friction is applied |
| 89 | |
| 90 | int delta_x_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_x_shot_move., delta_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#delta_y_shot_move.; |
| 91 | |
| 92 | int last_x_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#last_x_shot_move., last_y_shot_movecxx . . $ $anonymous_type_55bed0e189d5bed_4#last_y_shot_move.; |
| 93 | int last_x_explosion_followcxx . . $ $anonymous_type_55bed0e189d5bed_4#last_x_explosion_follow., last_y_explosion_followcxx . . $ $anonymous_type_55bed0e189d5bed_4#last_y_explosion_follow.; |
| 94 | |
| 95 | structcxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5# |
| 96 | { |
| 97 | // calculatable |
| 98 | int ammo_maxcxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#ammo_max.; |
| 99 | uintcxx . . $ uint# ammo_refill_ticks_maxcxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#ammo_refill_ticks_max.; |
| 100 | uintcxx . . $ uint# stylecxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#style.; // affects movement and size |
| 101 | |
| 102 | // state |
| 103 | int xcxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#x., ycxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#y.; |
| 104 | int ammocxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#ammo.; |
| 105 | uintcxx . . $ uint# ammo_refill_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#ammo_refill_ticks.; |
| 106 | |
| 107 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! animation_enabledcxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#animation_enabled.; |
| 108 | uintcxx . . $ uint# animation_framecxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#animation_frame.; |
| 109 | |
| 110 | uintcxx . . $ uint# chargecxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#charge.; |
| 111 | uintcxx . . $ uint# charge_tickscxx . . $ $anonymous_type_55bed0e189d5bed_4#$anonymous_type_5#charge_ticks.; |
| 112 | } |
| 113 | sidekickcxx . . $ $anonymous_type_55bed0e189d5bed_4#sidekick.[2]; |
| 114 | } |
| 115 | Playercxx . . $ Player#; |
| 116 | |
| 117 | extern Playercxx . . $ Player# playercxx . . $ player.[2]; |
| 118 | |
| 119 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! all_players_deadcxx . . $ all_players_dead(c9857a73d68e59ba).(void) |
| 120 | { |
| 121 | return (!playercxx . . $ player.[0].is_alivecxx . . $ $anonymous_type_55bed0e189d5bed_4#is_alive. && (!twoPlayerModecxx . . $ twoPlayerMode. || !playercxx . . $ player.[1].is_alivecxx . . $ $anonymous_type_55bed0e189d5bed_4#is_alive.)); |
| 122 | } |
| 123 | |
| 124 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! all_players_alivecxx . . $ all_players_alive(c9857a73d68e59ba).(void) |
| 125 | { |
| 126 | return (playercxx . . $ player.[0].is_alivecxx . . $ $anonymous_type_55bed0e189d5bed_4#is_alive. && (!twoPlayerModecxx . . $ twoPlayerMode. || playercxx . . $ player.[1].is_alivecxx . . $ $anonymous_type_55bed0e189d5bed_4#is_alive.)); |
| 127 | } |
| 128 | |
| 129 | void calc_purple_balls_neededcxx . . $ calc_purple_balls_needed(cda9d737d2f74dfa).(Playercxx . . $ Player# *); |
| 130 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! power_up_weaponcxx . . $ power_up_weapon(be6e6169371b08a7).(Playercxx . . $ Player# *, uintcxx . . $ uint# port); |
| 131 | void handle_got_purple_ballcxx . . $ handle_got_purple_ball(cda9d737d2f74dfa).(Playercxx . . $ Player# *); |
| 132 | |
| 133 | #endif // PLAYER_H |