Debian Codegraph @

src/elbowdownright.cpp

raw symbols SCIP
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"
19 #include "pointerelbowdownright.h"
20
21 ElbowDownRight::ElbowDownRight():Pipe(){
22 p=new PointerElbowDownRight();
23 }
24
25 ElbowDownRight::~ElbowDownRight(){
26 delete p;
27 }
28
29 bool ElbowDownRight::hasConnection(CardinalPoint con){
30 return ((con==East) || (con==South));
31 }
32
33 CardinalPoint ElbowDownRight::getOutput(CardinalPoint input){
34 if (input==ro) return Void;
35 switch (input){
36 case South: return East;
37 case East:return South;
38 default:return Void;
39 }
40 }
41
42 void ElbowDownRight::restrictAsOutput(CardinalPoint con){
43 if (con==East || con==South) ro=con;
44 }
45
46 bool ElbowDownRight::isRestrictedAsOutput(CardinalPoint con){
47 return (con==ro);
48 }
49
50 void ElbowDownRight::incFullLevel(CardinalPoint input,unsigned int amount){
51 if ((input==South || input==East) && input!=ro)
52 if ((used_input==Void) || (used_input==input)){
53 full_level+=amount;
54 used_input=input;
55 }
56 }
57
58 int ElbowDownRight::getFullLevel(CardinalPoint input){
59 if (input==used_input) return full_level;
60 return 0;
61 }
62
63 Pointer * ElbowDownRight::getPointer(){
64 return p;
65 }
66
67 void ElbowDownRight::paint(VideoManager * vm){
68 Image * ima;
69 if (fixed)
70 ima=(vm->getImageManager())->getImage(new Str("elbow_seb.png"));
71 else
72 ima=(vm->getImageManager())->getImage(new Str("elbow_se.png"));
73 vm->blit(ima, x, y);
74
75 if (ro!=Void) paintRestriction(vm, ro);
76
77 if (full_level>0){
78 Image * aux=(vm->getImageManager())->getImage(new Str("flow.png"));
79 float fwidth=(float)PipeWidth/2;
80 float fheight=(float)PipeHeight/2;
81 float nov=PI/2;
82 vm->setClipping(x, y, PipeWidth, PipeHeight);
83 vm->enableClipping(true);
84 int xaux=x+PipeWidth-aux->width()/2;
85 int yaux=y+PipeHeight-aux->width()/2;
86 if (used_input==South){
87 for (int i=0; i<full_level+1;i+=Gran)
88 vm->blit(aux, (int)(xaux-(float)cos((float)i/(float)full() * nov)*fwidth),
89 (int)(yaux-(float)sin((float)i/(float)full() * nov)*fheight));
90 }else{
91 for (int i=0; i<full_level+1;i+=Gran)
92 vm->blit(aux, (int)(xaux-(float)cos((float)(full()-i)/(float)full() * nov)*fwidth),
93 (int)(yaux-(float)sin((float)(full()-i)/(float)full() * nov)*fheight));
94 }
95 vm->enableClipping(false);
96 }
97 if (bonus!=NormalBonus) paintBonus(vm, bonus);
98 }