| 1 | /*************************************************************************** |
| 2 | elbowupleft.cpp - description |
| 3 | ------------------- |
| 4 | begin : Thu Aug 17 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 | |
| 18 | #include "elbowupleft.h"cxx . . $ `<file>/src/elbowupleft.h`/ |
| 19 | #include "pointerelbowupleft.h"cxx . . $ `<file>/src/pointerelbowupleft.h`/ |
| 20 | |
| 21 | ElbowUpLeftcxx . . $ ElbowUpLeft#::ElbowUpLeftcxx . . $ ElbowUpLeft#ElbowUpLeft(49f6e7a06ebc5aa8).():Pipecxx . . $ Pipe#(){ |
| 22 | pcxx . . $ Pipe#p.=new PointerElbowUpLeftcxx . . $ PointerElbowUpLeft#(); |
| 23 | } |
| 24 | |
| 25 | ElbowUpLeftcxx . . $ ElbowUpLeft#::~cxx . . $ ElbowUpLeft#`~ElbowUpLeft`(ced63f7c635d850d).ElbowUpLeftcxx . . $ ElbowUpLeft#(){ |
| 26 | delete pcxx . . $ Pipe#p.; |
| 27 | } |
| 28 | |
| 29 | bool ElbowUpLeftcxx . . $ ElbowUpLeft#::hasConnectioncxx . . $ ElbowUpLeft#hasConnection(eebf787ddd78fff5).(CardinalPointcxx . . $ CardinalPoint# con){ |
| 30 | return ((con==Northcxx . . $ North.) || (con==Westcxx . . $ West.)); |
| 31 | } |
| 32 | |
| 33 | CardinalPointcxx . . $ CardinalPoint# ElbowUpLeftcxx . . $ ElbowUpLeft#::getOutputcxx . . $ ElbowUpLeft#getOutput(fbd438076a101a96).(CardinalPointcxx . . $ CardinalPoint# input){ |
| 34 | if (input==rocxx . . $ Pipe#ro.) return Voidcxx . . $ Void.; |
| 35 | switch (input){ |
| 36 | case Northcxx . . $ North.: return Westcxx . . $ West.; |
| 37 | case Westcxx . . $ West.:return Northcxx . . $ North.; |
| 38 | default:return Voidcxx . . $ Void.; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void ElbowUpLeftcxx . . $ ElbowUpLeft#::restrictAsOutputcxx . . $ ElbowUpLeft#restrictAsOutput(c47d336573415769).(CardinalPointcxx . . $ CardinalPoint# con){ |
| 43 | if (con==Northcxx . . $ North. || con==Westcxx . . $ West.) rocxx . . $ Pipe#ro.=con; |
| 44 | } |
| 45 | |
| 46 | bool ElbowUpLeftcxx . . $ ElbowUpLeft#::isRestrictedAsOutputcxx . . $ ElbowUpLeft#isRestrictedAsOutput(eebf787ddd78fff5).(CardinalPointcxx . . $ CardinalPoint# con){ |
| 47 | return (con==rocxx . . $ Pipe#ro.); |
| 48 | } |
| 49 | |
| 50 | void ElbowUpLeftcxx . . $ ElbowUpLeft#::incFullLevelcxx . . $ ElbowUpLeft#incFullLevel(5c0eb7cda63e3855).(CardinalPointcxx . . $ CardinalPoint# input,unsigned int amount){ |
| 51 | if ((input==Northcxx . . $ North. || input==Westcxx . . $ West.) && rocxx . . $ Pipe#ro.!=input) |
| 52 | if ((used_inputcxx . . $ Pipe#used_input.==Voidcxx . . $ Void.) || (used_inputcxx . . $ Pipe#used_input.==input)){ |
| 53 | full_levelcxx . . $ Pipe#full_level.+=amount; |
| 54 | used_inputcxx . . $ Pipe#used_input.=input; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | int ElbowUpLeftcxx . . $ ElbowUpLeft#::getFullLevelcxx . . $ ElbowUpLeft#getFullLevel(bad1fd3a9fbe27b6).(CardinalPointcxx . . $ CardinalPoint# input){ |
| 59 | if (input==used_inputcxx . . $ Pipe#used_input.) |
| 60 | return full_levelcxx . . $ Pipe#full_level.; |
| 61 | return -1; |
| 62 | } |
| 63 | |
| 64 | Pointercxx . . $ Pointer# * ElbowUpLeftcxx . . $ ElbowUpLeft#::getPointercxx . . $ ElbowUpLeft#getPointer(519f973faac47112).(){ |
| 65 | return pcxx . . $ Pipe#p.; |
| 66 | } |
| 67 | |
| 68 | void ElbowUpLeftcxx . . $ ElbowUpLeft#::paintcxx . . $ ElbowUpLeft#paint(dec28a01b93bce57).(VideoManagercxx . . $ VideoManager# * vm){ |
| 69 | Imagecxx . . $ Image# * ima; |
| 70 | if (fixedcxx . . $ Pipe#fixed.) |
| 71 | ima=(vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).())->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("elbow_nwb.png")); |
| 72 | else |
| 73 | ima=(vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).())->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("elbow_nw.png")); |
| 74 | vm->blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(ima, xcxx . . $ Canvas#x., ycxx . . $ Canvas#y.); |
| 75 | |
| 76 | if (rocxx . . $ Pipe#ro.!=Voidcxx . . $ Void.) paintRestrictioncxx . . $ Pipe#paintRestriction(79d4807f4eb46d42).(vm, rocxx . . $ Pipe#ro.); |
| 77 | |
| 78 | if (full_levelcxx . . $ Pipe#full_level.>0){ |
| 79 | Imagecxx . . $ Image# * aux=(vm->getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).())->getImagecxx . . $ ImageManager#getImage(3ac71a4852078d03).(new Strcxx . . $ Str#("flow.png")); |
| 80 | float fwidth=(float)PipeWidthcxx . . $ PipeWidth./2; |
| 81 | float fheight=(float)PipeHeightcxx . . $ PipeHeight./2; |
| 82 | float nov=PIcxx . . $ `src/object.h:17:9`!/2; |
| 83 | vm->setClippingcxx . . $ Graphic#setClipping(748afa4755bc9595).(xcxx . . $ Canvas#x., ycxx . . $ Canvas#y., PipeWidthcxx . . $ PipeWidth., PipeHeightcxx . . $ PipeHeight.); |
| 84 | vm->enableClippingcxx . . $ Graphic#enableClipping(b45ddcbc8423892c).(true); |
| 85 | int xaux=xcxx . . $ Canvas#x.-aux->widthcxx . . $ Surface#width(b126dc7c1de90089).()/2; |
| 86 | int yaux=ycxx . . $ Canvas#y.-aux->widthcxx . . $ Surface#width(b126dc7c1de90089).()/2; |
| 87 | if (used_inputcxx . . $ Pipe#used_input.==Northcxx . . $ North.){ |
| 88 | for (int i=0; i<full_levelcxx . . $ Pipe#full_level.+1;i+=Grancxx . . $ Pipe#Gran.) |
| 89 | vm->blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(aux, (int)(xaux+(float)coscxx . . $ cos(fbcf3211dfe1bfd1).((float)i/(float)fullcxx . . $ Pipe#full(b126dc7c1de90089).() * nov)*fwidth), |
| 90 | (int)(yaux+(float)sincxx . . $ sin(fbcf3211dfe1bfd1).((float)i/(float)fullcxx . . $ Pipe#full(b126dc7c1de90089).() * nov)*fheight)); |
| 91 | }else{ |
| 92 | for (int i=0; i<full_levelcxx . . $ Pipe#full_level.+1;i+=Grancxx . . $ Pipe#Gran.) |
| 93 | vm->blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(aux, (int)(xaux+(float)coscxx . . $ cos(fbcf3211dfe1bfd1).((float)(fullcxx . . $ Pipe#full(b126dc7c1de90089).()-i)/(float)fullcxx . . $ Pipe#full(b126dc7c1de90089).() * nov)*fwidth), |
| 94 | (int)(yaux+(float)sincxx . . $ sin(fbcf3211dfe1bfd1).((float)(fullcxx . . $ Pipe#full(b126dc7c1de90089).()-i)/(float)fullcxx . . $ Pipe#full(b126dc7c1de90089).() * nov)*fheight)); |
| 95 | } |
| 96 | vm->enableClippingcxx . . $ Graphic#enableClipping(b45ddcbc8423892c).(false); |
| 97 | } |
| 98 | if (bonuscxx . . $ Pipe#bonus.!=NormalBonuscxx . . $ NormalBonus.) paintBonuscxx . . $ Pipe#paintBonus(1e922b71c0766333).(vm, bonuscxx . . $ Pipe#bonus.); |
| 99 | } |