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