Debian Codegraph @

src/elbowupright.cpp

raw symbols SCIP
1 /***************************************************************************
2 elbowupright.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 "elbowupright.h"
19 #include "pointerelbowupright.h"
20
21 ElbowUpRight::ElbowUpRight():Pipe(){
22 p=new PointerElbowUpRight();
23 }
24
25 ElbowUpRight::~ElbowUpRight(){
26 delete p;
27 }
28
29 bool ElbowUpRight::hasConnection(CardinalPoint con){
30 return ((con==North) || (con==East));
31 }
32
33 CardinalPoint ElbowUpRight::getOutput(CardinalPoint input){
34 switch (input){
35 case North: return East;
36 case East:return North;
37 default:return Void;
38 }
39 }
40
41 void ElbowUpRight::restrictAsOutput(CardinalPoint con){
42 if (con==East || con==North) ro=con;
43 }
44
45 bool ElbowUpRight::isRestrictedAsOutput(CardinalPoint con){
46 return (con==ro);
47 }
48
49 void ElbowUpRight::incFullLevel(CardinalPoint input,unsigned int amount){
50 if ((input==North || input==East) && input!=ro)
51 if ((used_input==Void) || (used_input==input)){
52 full_level+=amount;
53 used_input=input;
54 }
55 }
56
57 int ElbowUpRight::getFullLevel(CardinalPoint input){
58 if (input==used_input)
59 return full_level;
60 return 0;
61 }
62
63 Pointer * ElbowUpRight::getPointer(){
64 return p;
65 }
66
67 void ElbowUpRight::paint(VideoManager * vm){
68 Image * ima;
69 if (fixed)
70 ima=(vm->getImageManager())->getImage(new Str("elbow_neb.png"));
71 else
72 ima=(vm->getImageManager())->getImage(new Str("elbow_ne.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-aux->width()/2;
86 if (used_input==North){
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 }
99