| 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 | #include "player.h"cxx . . $ `<file>/src/player.h`/ |
| 20 | |
| 21 | Playercxx . . $ Player# playercxx . . $ player.[2]; |
| 22 | |
| 23 | void calc_purple_balls_neededcxx . . $ calc_purple_balls_needed(cda9d737d2f74dfa).(Playercxx . . $ Player# *this_player) |
| 24 | { |
| 25 | static const uintcxx . . $ uint# purple_balls_required[12] = { 1, 1, 2, 4, 8, 12, 16, 20, 25, 30, 40, 50 }; |
| 26 | |
| 27 | this_player->purple_balls_neededcxx . . $ $anonymous_type_55bed0e189d5bed_4#purple_balls_needed. = purple_balls_required[*this_player->livescxx . . $ $anonymous_type_55bed0e189d5bed_4#lives.]; |
| 28 | } |
| 29 | |
| 30 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! power_up_weaponcxx . . $ power_up_weapon(be6e6169371b08a7).(Playercxx . . $ Player# *this_player, uintcxx . . $ uint# port) |
| 31 | { |
| 32 | const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! can_power_up = this_player->itemscxx . . $ $anonymous_type_55bed0e189d5bed_4#items..weaponcxx . . $ $anonymous_type_55bed0e189d5bed_2#weapon.[port].idcxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3#id. != 0 && // not None |
| 33 | this_player->itemscxx . . $ $anonymous_type_55bed0e189d5bed_4#items..weaponcxx . . $ $anonymous_type_55bed0e189d5bed_2#weapon.[port].powercxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3#power. < 11; // not at max power |
| 34 | if (can_power_up) |
| 35 | { |
| 36 | ++this_player->itemscxx . . $ $anonymous_type_55bed0e189d5bed_4#items..weaponcxx . . $ $anonymous_type_55bed0e189d5bed_2#weapon.[port].powercxx . . $ $anonymous_type_55bed0e189d5bed_2#$anonymous_type_3#power.; |
| 37 | shotMultiPoscxx . . $ shotMultiPos.[port] = 0; // TODO: should be part of Player structure |
| 38 | |
| 39 | calc_purple_balls_neededcxx . . $ calc_purple_balls_needed(cda9d737d2f74dfa).(this_player); |
| 40 | } |
| 41 | else // cash consolation prize |
| 42 | { |
| 43 | this_player->cashcxx . . $ $anonymous_type_55bed0e189d5bed_4#cash. += 1000; |
| 44 | } |
| 45 | |
| 46 | return can_power_up; |
| 47 | } |
| 48 | |
| 49 | void handle_got_purple_ballcxx . . $ handle_got_purple_ball(cda9d737d2f74dfa).(Playercxx . . $ Player# *this_player) |
| 50 | { |
| 51 | if (this_player->purple_balls_neededcxx . . $ $anonymous_type_55bed0e189d5bed_4#purple_balls_needed. > 1) |
| 52 | --this_player->purple_balls_neededcxx . . $ $anonymous_type_55bed0e189d5bed_4#purple_balls_needed.; |
| 53 | else |
| 54 | power_up_weaponcxx . . $ power_up_weapon(be6e6169371b08a7).(this_player, this_player->is_dragonwingcxx . . $ $anonymous_type_55bed0e189d5bed_4#is_dragonwing. ? REAR_WEAPONcxx . . $ REAR_WEAPON. : FRONT_WEAPONcxx . . $ FRONT_WEAPON.); |
| 55 | } |