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