| 1 | /*************************************************************************** |
| 2 | tank.cpp - description |
| 3 | ------------------- |
| 4 | begin : Fri Dec 29 2000 |
| 5 | copyright : (C) 2000 by Waldemar Baraldi |
| 6 | email : [email protected] |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | /*************************************************************************** |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or modify * |
| 12 | * it under the terms of the GNU General Public License as published by * |
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
| 14 | * (at your option) any later version. * |
| 15 | * * |
| 16 | ***************************************************************************/ |
| 17 | #include "tank.h"cxx . . $ `<file>/src/tank.h`/ |
| 18 | |
| 19 | #define MAX_STATEcxx . . $ `src/tank.cpp:19:9`! 20 |
| 20 | |
| 21 | Tankcxx . . $ Tank#::Tankcxx . . $ Tank#Tank(cb2f890c2fdad230).(unsigned int full_level):AnimatedCanvascxx . . $ AnimatedCanvas#(){ |
| 22 | this->full_levelcxx . . $ Tank#full_level.=full_level%(Capacitycxx . . $ Tank#Capacity.-1); |
| 23 | statecxx . . $ Tank#state.=0; |
| 24 | changedcxx . . $ Tank#changed.=true; |
| 25 | } |
| 26 | |
| 27 | Tankcxx . . $ Tank#::~cxx . . $ Tank#`~Tank`(ced63f7c635d850d).Tankcxx . . $ Tank#(){} |
| 28 | |
| 29 | void Tankcxx . . $ Tank#::decFullLevelcxx . . $ Tank#decFullLevel(cb2f890c2fdad230).(unsigned int amount){ |
| 30 | if (full_levelcxx . . $ Tank#full_level.>0 && (unsigned int)full_levelcxx . . $ Tank#full_level.>amount) |
| 31 | full_levelcxx . . $ Tank#full_level.-=amount; |
| 32 | else full_levelcxx . . $ Tank#full_level.=0; |
| 33 | changedcxx . . $ Tank#changed.=true; |
| 34 | } |
| 35 | |
| 36 | bool Tankcxx . . $ Tank#::isEmptycxx . . $ Tank#isEmpty(c9857a73d68e59ba).(){ |
| 37 | return full_levelcxx . . $ Tank#full_level.<=0; |
| 38 | } |
| 39 | |
| 40 | bool Tankcxx . . $ Tank#::isChangedcxx . . $ Tank#isChanged(c9857a73d68e59ba).(){ |
| 41 | return changedcxx . . $ Tank#changed.; |
| 42 | } |
| 43 | |
| 44 | void Tankcxx . . $ Tank#::paintcxx . . $ Tank#paint(dec28a01b93bce57).(VideoManagercxx . . $ VideoManager# * vm){ |
| 45 | int f=(int)((float)TankHeightcxx . . $ Tank#TankHeight.*(float)full_levelcxx . . $ Tank#full_level./(float)Capacitycxx . . $ Tank#Capacity.); |
| 46 | Imagecxx . . $ Image# * ima; |
| 47 | |
| 48 | // Borra |
| 49 | vm->fillRectcxx . . $ VideoManager#fillRect(399580efc014f2ba).(xcxx . . $ Canvas#x.,ycxx . . $ Canvas#y.,TankWidthcxx . . $ Tank#TankWidth.,TankHeightcxx . . $ Tank#TankHeight.-f, 0,0,0,OPAQUEcxx . . $ `src/graphic.h:26:9`!); |
| 50 | //Dibuja el liquido |
| 51 | vm->fillRectcxx . . $ VideoManager#fillRect(399580efc014f2ba).(xcxx . . $ Canvas#x.,ycxx . . $ Canvas#y.+TankHeightcxx . . $ Tank#TankHeight.-f, TankWidthcxx . . $ Tank#TankWidth., f, 103,234,16,OPAQUEcxx . . $ `src/graphic.h:26:9`!); |
| 52 | //Pinta el frente |
| 53 | ima=(vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).())->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("tank.png")); |
| 54 | vm->blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(ima,xcxx . . $ Canvas#x.,ycxx . . $ Canvas#y.); |
| 55 | changedcxx . . $ Tank#changed.=false; |
| 56 | } |
| 57 | |
| 58 | void Tankcxx . . $ Tank#::tickcxx . . $ Tank#tick(49f6e7a06ebc5aa8).(){ |
| 59 | statecxx . . $ Tank#state.=(statecxx . . $ Tank#state.+1)%MAX_STATEcxx . . $ `src/tank.cpp:19:9`!; |
| 60 | } |
| 61 | |
| 62 |