source: liacs/mss/assignment2/TalkShadowFun.diff@ 12

Last change on this file since 12 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 3.0 KB
RevLine 
[2]1diff -ur ../SRWorkshop/TalkShadowFun/cmdmode.xml ./cmdmode.xml
2--- ../SRWorkshop/TalkShadowFun/cmdmode.xml 2003-10-25 23:19:52.000000000 +0200
3+++ ./cmdmode.xml 2009-10-28 14:50:14.000000000 +0100
4@@ -5,6 +5,9 @@
5 <ID NAME="PID_CmdRight" VAL="2"/>
6 <ID NAME="PID_CmdUp" VAL="3"/>
7 <ID NAME="PID_CmdDown" VAL="4"/>
8+ <ID NAME="PID_CmdForward" VAL="5"/>
9+ <ID NAME="PID_CmdBackward" VAL="6"/>
10+
11 <ID NAME="PID_CmdNavigation" VAL="1000"/>
12 <ID NAME="PID_Moving" VAL="1001"/>
13 </DEFINE>
14@@ -19,6 +22,9 @@
15 <P VAL="PID_CmdUp">higher</P>
16 <P VAL="PID_CmdDown">down</P>
17 <P VAL="PID_CmdDown">lower</P>
18+ <P VAL="PID_CmdForward">forward</P>
19+ <P VAL="PID_CmdBackward">backward</P>
20+
21 </L>
22 </RULE>
23
24diff -ur ../SRWorkshop/TalkShadowFun/shadowfun.cpp ./shadowfun.cpp
25--- ../SRWorkshop/TalkShadowFun/shadowfun.cpp 2003-10-25 23:14:56.000000000 +0200
26+++ ./shadowfun.cpp 2009-10-28 14:50:26.000000000 +0100
27@@ -102,7 +102,7 @@
28 //SR Workshop
29 // Commands
30 enum {
31- C_NONE, C_LEFT, C_RIGHT, C_UP, C_DOWN, C_HOME, C_STOP
32+ C_NONE, C_LEFT, C_RIGHT, C_UP, C_DOWN, C_HOME, C_STOP, C_FORWARD, C_BACKWARD
33 };
34
35 int listening = 0; // boolean use: 0 = false, 1= true
36@@ -326,6 +326,8 @@
37 if (recogstr.Find("down") != -1) { command = C_DOWN; }
38 if (recogstr.Find("home") != -1) { command = C_HOME; }
39 if (recogstr.Find("stop") != -1) { command = C_STOP; }
40+ if (recogstr.Find("forward") != -1) { command = C_FORWARD; }
41+ if (recogstr.Find("backward") != -1) { command = C_BACKWARD; }
42
43 if (fUseTTS)
44 {
45@@ -1080,32 +1082,48 @@
46 glutSwapBuffers();
47 }
48
49+#define MOVE_FACTOR 0.5
50+
51 //SR Workshop
52 void MoveLeft(int value)
53 {
54 // value should be in range M_TORUS, M_CUBE, M_SPHERE
55- animPos[value][X] -= 1.0;
56+ animPos[value][X] -= MOVE_FACTOR;
57 }
58
59 //SR Workshop
60 void MoveRight(int value)
61 {
62 // value should be in range M_TORUS, M_CUBE, M_SPHERE
63- animPos[value][X] += 1.0;
64+ animPos[value][X] += MOVE_FACTOR;
65 }
66
67 //SR Workshop
68 void MoveUp(int value)
69 {
70 // value should be in range M_TORUS, M_CUBE, M_SPHERE
71- animPos[value][Y] += 1.0;
72+ animPos[value][Y] += MOVE_FACTOR;
73 }
74
75 //SR Workshop
76 void MoveDown(int value)
77 {
78 // value should be in range M_TORUS, M_CUBE, M_SPHERE
79- animPos[value][Y] -= 1.0;
80+ animPos[value][Y] -= MOVE_FACTOR;
81+}
82+
83+//SR Workshop
84+void MoveForward(int value)
85+{
86+ // value should be in range M_TORUS, M_CUBE, M_SPHERE
87+ animPos[value][Z] += MOVE_FACTOR;
88+}
89+
90+//SR Workshop
91+void MoveBackward(int value)
92+{
93+ // value should be in range M_TORUS, M_CUBE, M_SPHERE
94+ animPos[value][Z] -= MOVE_FACTOR;
95 }
96
97 //SR Workshop
98@@ -1144,6 +1162,12 @@
99 case C_DOWN:
100 MoveDown(M_SPHERE);
101 break;
102+ case C_FORWARD:
103+ MoveForward(M_SPHERE);
104+ break;
105+ case C_BACKWARD:
106+ MoveBackward(M_SPHERE);
107+ break;
108 case C_HOME:
109 MoveHome(M_SPHERE);
110 break;
Note: See TracBrowser for help on using the repository browser.