SDL Uint types ; SDL_GetTicks ; fix some warnings ; fix keyboard log for speed/accuracy
authorThomas Pietrzak <thomas.pietrzak@gmail.com>
Wed, 1 Jun 2011 14:16:19 +0000 (14:16 +0000)
committerThomas Pietrzak <thomas.pietrzak@gmail.com>
Wed, 1 Jun 2011 14:16:19 +0000 (14:16 +0000)
git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@19 47cf9a05-e0a8-4ed5-9e9b-101a649bc004

20 files changed:
Haptic Metronome/Haptic Metronome.suo
Haptic Metronome/Haptic Metronome/Haptic Metronome.vcxproj
include/Config.hpp
include/MIDIReader.hpp
include/Metronome.hpp
include/MetronomeAudio.hpp
include/MetronomeHaptic.hpp
include/PaintGame.h
include/Tools.hpp
include/Track.hpp
include/Wiimote.hpp
src/Config.cpp
src/MIDIReader.cpp
src/Metronome.cpp
src/MetronomeAudio.cpp
src/MetronomeHaptic.cpp
src/PaintGame.cpp
src/Track.cpp
src/Wiimote.cpp
src/main.cpp

index a3b5701c4c8ad878db1c45df4247c567efc915b5..6db2e2cbbb797790d03d3691cb61c6e9c8307b08 100644 (file)
Binary files a/Haptic Metronome/Haptic Metronome.suo and b/Haptic Metronome/Haptic Metronome.suo differ
index 0161ee4bd7e8bb099f35e7c05ac24c6723e2c64b..dfe52a4e573ef296d1ca31b80205daa4650b7f53 100644 (file)
@@ -52,7 +52,7 @@
     <ClCompile>\r
       <WarningLevel>Level3</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
-      <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32;FULLSCREEN</PreprocessorDefinitions>\r
     </ClCompile>\r
     <Link>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
index 54d0e54b7ed7c915593a65c1a1cac41485d15dd4..5911026900b8097f7ab3ed112ac87b4366f95788 100644 (file)
@@ -16,7 +16,8 @@ enum keys { KEY0 = 0, KEY1 = 1, KEY2 = 2, KEY3 = 3, KEY4 = 4 };
 #define NOTEDIST 5
 
 #include <GL/glew.h>
-#include <stdint.h> 
+#include <SDL/SDL.h>
+//#include <stdint.h> 
 #include <iostream>
 using namespace std;
 
@@ -26,9 +27,9 @@ using namespace std;
 class Config
 {
        public:
-               Config(uint8_t buttons, uint32_t timestamp=0, uint32_t endtimestamp=0, uint32_t time=0, uint32_t ticks=0);
+               Config(Uint8 buttons, Uint32 timestamp=0, Uint32 endtimestamp=0, Uint32 time=0, Uint32 ticks=0);
 
-               Config(uint32_t timestamp=0, uint32_t endtimestamp=0, uint32_t time=0, uint32_t ticks=0,
+               Config(Uint32 timestamp=0, Uint32 endtimestamp=0, Uint32 time=0, Uint32 ticks=0,
                        bool a=false, bool b=false, bool c=false, bool d=false, bool e=false);
 
                Config(const Config &cf);
@@ -39,17 +40,17 @@ class Config
                void remKey(keys k);
                void setKeys(bool a, bool b, bool c, bool d, bool e);
 
-               void setTimestamp(uint32_t t) { _timestamp = t; }
-               uint32_t getTimestamp() const { return _timestamp; }
+               void setTimestamp(Uint32 t) { _timestamp = t; }
+               Uint32 getTimestamp() const { return _timestamp; }
 
-               void setEndTimestamp(uint32_t t) { _endtimestamp = t; }
-               uint32_t getEndTimestamp() const { return _endtimestamp; }
+               void setEndTimestamp(Uint32 t) { _endtimestamp = t; }
+               Uint32 getEndTimestamp() const { return _endtimestamp; }
 
-               void setTime(uint32_t t) { _time = t; }
-               uint32_t getTime() const { return _time; }
+               void setTime(Uint32 t) { _time = t; }
+               Uint32 getTime() const { return _time; }
 
-               void setTicks(uint32_t t) { _ticks = t; }
-               uint32_t getTicks() const { return _ticks; }
+               void setTicks(Uint32 t) { _ticks = t; }
+               Uint32 getTicks() const { return _ticks; }
 
                void display() const;
                void log(const String &type, FILE *file) const;
@@ -61,8 +62,8 @@ class Config
                bool isNone() const { return !(_a || _b || _c || _d || _e ); }
 
        private:
-               uint32_t _timestamp, _endtimestamp;
-               uint32_t _time, _ticks;
+               Uint32 _timestamp, _endtimestamp;
+               Uint32 _time, _ticks;
                bool _a, _b, _c, _d, _e;
 };
 
index 6c5da3348f245a38f1c888c09723dbbcff39dbc0..dc9e185ff54fb177650308dbec090f49b57335d7 100644 (file)
@@ -24,13 +24,13 @@ class MIDIReader
     MIDIReader(const MIDIReader &);
 
     FILE *_file;
-    uint16_t _nbtracks;
-    uint16_t _timedivision;
+    Uint16 _nbtracks;
+    Uint16 _timedivision;
 //     unsigned long int _position;
-    uint8_t readVariableLength(uint32_t &);
-    void readBytes(void *, uint32_t);
-               void printBytes(uint8_t *data, uint32_t length);
-    uint32_t _position;
+    Uint8 readVariableLength(Uint32 &);
+    void readBytes(void *, Uint32);
+               void printBytes(Uint8 *data, Uint32 length);
+    Uint32 _position;
 };
 
 #endif
index 69a55e02e7c185f2390552de979914862f18b6ff..cbcd7b5cfa44b207b18136c83af5bb86277b64ed 100644 (file)
@@ -7,18 +7,18 @@
 class Metronome\r
 {\r
        public:\r
-               Metronome(const Track *track, uint32_t nbbeats=4, uint32_t tempo=0, bool activated=false);\r
+               Metronome(const Track *track, Uint32 nbbeats=4, Uint32 tempo=0, bool activated=false);\r
                virtual ~Metronome(){}\r
 \r
                virtual void setActive(bool activated) { _activated = activated; }\r
-               virtual void setTempo(uint32_t tempo) { _tempo = tempo; }\r
-               virtual void setNbBeats(uint32_t nbbeats) {_nbbeats = nbbeats; }\r
+               virtual void setTempo(Uint32 tempo) { _tempo = tempo; }\r
+               virtual void setNbBeats(Uint32 nbbeats) {_nbbeats = nbbeats; }\r
 \r
                virtual void run()=0;\r
 \r
        protected:\r
-               uint32_t _nbbeats;\r
-               uint32_t _tempo;\r
+               Uint32 _nbbeats;\r
+               Uint32 _tempo;\r
                bool _activated;\r
                const Track *_track;\r
 };\r
index 8956755d8a74dfb38e7791ed2f0a5dd46ccd849d..7134ffc165d9659f24c26ece43a07126457b9741 100644 (file)
@@ -13,7 +13,7 @@
 class MetronomeAudio : public Metronome\r
 {      \r
        public:\r
-               MetronomeAudio(const Track *track, uint32_t nbbeats=4, uint32_t tempo=0, bool activated=true);\r
+               MetronomeAudio(const Track *track, Uint32 nbbeats=4, Uint32 tempo=0, bool activated=true);\r
 \r
                ~MetronomeAudio();\r
 \r
index 72eff232b9c208a2636acd2136e0d941d36348c8..a8a7a98fe2b6a0c5923d2fa2cc8629eb620e4400 100644 (file)
 class MetronomeHaptic : public Metronome\r
 {      \r
        public:\r
-               MetronomeHaptic(const Track *track, uint32_t nbbeats=4, uint32_t tempo=0, bool activated=true);\r
+               MetronomeHaptic(const Track *track, Uint32 nbbeats=4, Uint32 tempo=0, bool activated=true);\r
 \r
                ~MetronomeHaptic();\r
 \r
-               void setTempo(uint32_t tempo);\r
-               void setNbBeats(uint32_t nbbeats);\r
+               void setTempo(Uint32 tempo);\r
+               void setNbBeats(Uint32 nbbeats);\r
 \r
                void run();\r
 \r
index a223b76a00f1e15c3fe70a514d12ad445659bd30..c08af901c1a435c22b1ae3f2f93e121b93feaa32 100644 (file)
@@ -5,6 +5,8 @@
 #define POSITION_EYE    45
 #define POSITION_CENTER (-70)
 
+#include <SDL/SDL.h>
+
 #include "Track.hpp"
 #include "String.hpp"
 
@@ -16,11 +18,11 @@ void draw(const Track &t, char diff);
 void drawCube(float pos, float size, float colorx, float colory, float colorz);
 void drawLong(float pos, float size, float length, float colorx, float colory, float colorz);
 \r
-void handleKeyOn(keys k, uint32_t currenttime);\r
-void handleKeyOff(keys k, uint32_t currenttime);\r
-void handleKeys(bool a, bool b, bool c, bool d, bool e, uint32_t currenttime);
-void handleStrokeOn(uint32_t currenttime);\r
-void handleStrokeOff(uint32_t currenttime);\r
+void handleKeyOn(keys k, Uint32 currenttime);\r
+void handleKeyOff(keys k, Uint32 currenttime);\r
+void handleKeys(bool a, bool b, bool c, bool d, bool e, Uint32 currenttime);
+void handleStrokeOn(Uint32 currenttime);\r
+void handleStrokeOff(Uint32 currenttime);\r
 bool processEvents();
 void loop(const Track &tr, const String &songname);
 
@@ -29,11 +31,11 @@ class MyWiimote: public Wiimote
        public:
                MyWiimote():Wiimote(1){}
 
-               void handleStrumOn(uint32_t currenttime) { handleStrokeOn(currenttime); }
-               void handleStrumOff(uint32_t currenttime) { handleStrokeOff(currenttime); }
-               void handleButtonOn(int k, uint32_t currenttime) { handleKeyOn(keys(k), currenttime); }
-               void handleButtonOff(int k, uint32_t currenttime) { handleKeyOff(keys(k), currenttime); }
-               void handleButtons(bool a, bool b, bool c, bool d, bool e, uint32_t currenttime) { handleKeys(a, b, c, d, e, currenttime); }
+               void handleStrumOn(Uint32 currenttime) { handleStrokeOn(currenttime); }
+               void handleStrumOff(Uint32 currenttime) { handleStrokeOff(currenttime); }
+               void handleButtonOn(int k, Uint32 currenttime) { handleKeyOn(keys(k), currenttime); }
+               void handleButtonOff(int k, Uint32 currenttime) { handleKeyOff(keys(k), currenttime); }
+               void handleButtons(bool a, bool b, bool c, bool d, bool e, Uint32 currenttime) { handleKeys(a, b, c, d, e, currenttime); }
 };
 \r
 #endif\r
index 3dde2e43ee2ce1018945dd9eb90bc60bbe4175dd..aad0d5f62e735af6ca04a269f77ef380b5ad9927 100644 (file)
 #include <iostream>\r
 using namespace std;\r
 
+typedef enum
+{
+       REGULAR,
+       TOMSLAW,
+       SPEEDACCURACY
+} GameType;
+
 #define MAX(X,Y) (X)>(Y)?(X):(Y)
 #define MIN(X,Y) (X)<(Y)?(X):(Y)
 
index efcc702eea82ea6eccfadfd706e2a235e8f949b4..03f272faa794240a6e89b631d304adddeff10d15 100644 (file)
@@ -7,7 +7,7 @@ enum difficulties { EASY, NORMAL, HARD, EXPERT };
 
 #include <list>
 #include <map>
-#include <stdint.h> 
+#include <SDL/SDL.h> 
 
 //temp
 #include <iostream>
@@ -41,45 +41,45 @@ class Track
     Track();
     Track(const Track &);
        //create an empty track with the specified tempo and specified duration
-    Track(uint32_t tempo, uint32_t duration);
+    Track(Uint32 tempo, Uint32 duration);
        //create a track for speed/accuracy experiments
-    Track(uint8_t nbbuttons, uint8_t repetitions, uint8_t nbspeeds, uint32_t *speeds);
+    Track(Uint8 nbbuttons, Uint8 repetitions, Uint8 nbspeeds, Uint32 *speeds);
     ~Track();
 
-    void addKey(uint32_t time, uint8_t note);
-    void remKey(uint32_t time, uint8_t note);
+    void addKey(Uint32 time, Uint8 note);
+    void remKey(Uint32 time, Uint8 note);
 
-    void addTempo(uint32_t tick, uint32_t timestamp, uint32_t t) { _tempo[tick] =  Pair<uint32_t, uint32_t>(timestamp, t); }
-    void addTimesignature(uint32_t tick, uint32_t timestamp, uint32_t t) { _timesignatures[tick] = Pair<uint32_t, uint32_t>(timestamp, t); }
-       const map<uint32_t, Pair<uint32_t, uint32_t> > *getTempos() const { return &_tempo; }  
-       const map<uint32_t, Pair<uint32_t, uint32_t> > *getTimeSignatures() const { return &_timesignatures; }
+    void addTempo(Uint32 tick, Uint32 timestamp, Uint32 t) { _tempo[tick] =  Pair<Uint32, Uint32>(timestamp, t); }
+    void addTimesignature(Uint32 tick, Uint32 timestamp, Uint32 t) { _timesignatures[tick] = Pair<Uint32, Uint32>(timestamp, t); }
+       const map<Uint32, Pair<Uint32, Uint32> > *getTempos() const { return &_tempo; }  
+       const map<Uint32, Pair<Uint32, Uint32> > *getTimeSignatures() const { return &_timesignatures; }
 
 //     int getTempo() const { return _currenttempo; }
     
 //     void setTempo(uint32 t) { _currenttempo = t; }
     
 //     uint32 beatsToTicks(uint32 time) { return (time * _currenttempo * 480) / 60000.0; }
-//    uint32_t beatsToTicks(uint32_t time, uint32_t tempo) { return (time * tempo * 480) / 60000; }
-//    uint32_t ticksToBeats(uint32_t time) { return 60000000 / time; }
+//    Uint32 beatsToTicks(Uint32 time, Uint32 tempo) { return (time * tempo * 480) / 60000; }
+//    Uint32 ticksToBeats(Uint32 time) { return 60000000 / time; }
 
     void displayTracks();
-    void drawFrets(uint32_t postime) const;
-    void drawNotes(uint32_t postime, uint8_t difficulty) const;
+    void drawFrets(Uint32 postime) const;
+    void drawNotes(Uint32 postime, Uint8 difficulty) const;
 //    void checkMetronome(float postime, Metronome *m) const;
 
-    uint32_t getNbNotes(uint32_t k) const { return _nbnotes[k]; }
-    uint32_t getTotalLength(uint32_t k) const { return _totallength[k]; }
-    uint32_t getTotalNotes(uint32_t k) const { return _totalnotes[k]; }
+    Uint32 getNbNotes(Uint32 k) const { return _nbnotes[k]; }
+    Uint32 getTotalLength(Uint32 k) const { return _totallength[k]; }
+    Uint32 getTotalNotes(Uint32 k) const { return _totalnotes[k]; }
 
-    void setEndOfTrack(uint32_t length) { if (length > _trackSize) _trackSize = length; }
-    uint32_t getEndOfTrack() const { return _trackSize; }
+    void setEndOfTrack(Uint32 length) { if (length > _trackSize) _trackSize = length; }
+    Uint32 getEndOfTrack() const { return _trackSize; }
 
-    Config getNote(uint32_t pos, uint8_t difficulty);
-    uint32_t getTempo(uint32_t tick);
-    uint32_t getTimeSignature(uint32_t tick);
+    Config getNote(Uint32 pos, Uint8 difficulty);
+    Uint32 getTempo(Uint32 tick);
+    Uint32 getTimeSignature(Uint32 tick);
 
-       const list<Pair<uint32_t, uint32_t> > * getBips() const { return &_bips; }
-       void addBip(uint32_t tick, uint32_t timestamp) { _bips.push_back(Pair<uint32_t, uint32_t>(tick, timestamp)); }
+       const list<Pair<Uint32, Uint32> > * getBips() const { return &_bips; }
+       void addBip(Uint32 tick, Uint32 timestamp) { _bips.push_back(Pair<Uint32, Uint32>(tick, timestamp)); }
 
     //void computeBips();
 
@@ -87,19 +87,19 @@ class Track
 
   private:
     //notes : position ; configs
-    map<uint32_t, Config> _notes[NBDIFFICULTIES];
-    map<uint32_t, Pair<uint32_t, uint32_t> > _tempo; //microseconds per quarter-note 
-    map<uint32_t, Pair<uint32_t, uint32_t> > _timesignatures;
+    map<Uint32, Config> _notes[NBDIFFICULTIES];
+    map<Uint32, Pair<Uint32, Uint32> > _tempo; //microseconds per quarter-note 
+    map<Uint32, Pair<Uint32, Uint32> > _timesignatures;
 
        // (beat, timestamp)
-    list<Pair<uint32_t, uint32_t> > _bips;
+    list<Pair<Uint32, Uint32> > _bips;
     
     Config _currentconfig[NBDIFFICULTIES];
     
-    uint32_t _nbnotes[NBDIFFICULTIES];
-    uint32_t _totallength[NBDIFFICULTIES];
-    uint32_t _totalnotes[128];
-    uint32_t _trackSize;
+    Uint32 _nbnotes[NBDIFFICULTIES];
+    Uint32 _totallength[NBDIFFICULTIES];
+    Uint32 _totalnotes[128];
+    Uint32 _trackSize;
     bool _active;
 };
 
index 87b9a780f0baee071954eaef904acaadf9a32ef1..83e296372e26b131c62ff6e58b76529becb9cc97 100644 (file)
@@ -1,14 +1,10 @@
 #ifndef __WIIMOTE__
 #define __WIIMOTE__
 
-#ifndef WIN32
-       #include <unistd.h>
-#else
-       #include <stdint.h>
-#endif
-
 #include <wiiuse.h>
 
+#include <SDL/SDL.h>
+
 
 #define MAX_WIIMOTES 4
 
@@ -20,14 +16,14 @@ class Wiimote{
 
                void vibration(int wiimote, int time);
 
-               virtual void handleStrumOn(uint32_t currenttime) = 0;
-               virtual void handleStrumOff(uint32_t currenttime) = 0;
-               virtual void handleButtonOn(int k, uint32_t currenttime) = 0;
-               virtual void handleButtonOff(int k, uint32_t currenttime) = 0;
-               virtual void handleButtons(bool a, bool b, bool c, bool d, bool e, uint32_t currenttime) = 0;
+               virtual void handleStrumOn(Uint32 currenttime) = 0;
+               virtual void handleStrumOff(Uint32 currenttime) = 0;
+               virtual void handleButtonOn(int k, Uint32 currenttime) = 0;
+               virtual void handleButtonOff(int k, Uint32 currenttime) = 0;
+               virtual void handleButtons(bool a, bool b, bool c, bool d, bool e, Uint32 currenttime) = 0;
 
        private:
-               void handleKey(guitar_hero_3_t* gh3, int key, int button, uint32_t currenttime);
+               void handleKey(guitar_hero_3_t* gh3, int key, int button, Uint32 currenttime);
                wiimote **_wiimotes;
                int _nb;
                bool _strumstate, _keystate[5];
index fd0bb7e55a1f9417368350be28ac0d0b3ef66f97..a69d1e7c2ef1435e447a99dd73fbbe345287034d 100644 (file)
@@ -3,13 +3,13 @@
 
 #include "PaintGame.h"
 
-Config::Config(uint32_t timestamp, uint32_t endtimestamp, uint32_t time, uint32_t ticks, bool a, bool b, bool c, bool d, bool e)
+Config::Config(Uint32 timestamp, Uint32 endtimestamp, Uint32 time, Uint32 ticks, bool a, bool b, bool c, bool d, bool e)
 :_timestamp(timestamp), _endtimestamp(endtimestamp), _time(time), _ticks(ticks), 
        _a(a), _b(b), _c(c), _d(d), _e(e)
 {
 }
 
-Config::Config(uint8_t buttons, uint32_t timestamp, uint32_t endtimestamp, uint32_t time, uint32_t ticks)
+Config::Config(Uint8 buttons, Uint32 timestamp, Uint32 endtimestamp, Uint32 time, Uint32 ticks)
 :_timestamp(timestamp), _endtimestamp(endtimestamp), _time(time), _ticks(ticks), 
 _a(buttons & 0x01), _b((buttons >> 1) & 0x01), _c((buttons >> 2) & 0x01), _d((buttons >> 3) & 0x01), _e((buttons >> 4) & 0x01)
 {
index 9429c9de3427a72c4b54b29eca9fe6dc72b1c81d..4c4527792ee93f15f0d73d65b33347c54d566705 100644 (file)
@@ -52,7 +52,7 @@ void MIDIReader::readHeader()
        if (!_file)
                return;
        
-       uint8_t temp[4];
+       Uint8 temp[4];
        
        //read the chunk ID
        fread((void *)(temp), 1, 4, _file);
@@ -63,12 +63,12 @@ void MIDIReader::readHeader()
        }
 
        //read the chunk size
-       uint32_t chunksize;
+       Uint32 chunksize;
        readBytes(&chunksize, 4);
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Header size: %d\n", chunksize);
 
        //read the format
-       uint16_t format;
+       Uint16 format;
        readBytes(&format, 2);
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Format type: %d\n", format);
        
@@ -87,7 +87,7 @@ void MIDIReader::readHeader()
 
 void MIDIReader::skipTrack()
 {
-       uint8_t temp[4];
+       Uint8 temp[4];
        //read the chunk ID
        fread((void *)(temp), 4, 1, _file);
 //      cerr << temp << endl;
@@ -98,7 +98,7 @@ void MIDIReader::skipTrack()
        }
 
        //read the chunk size
-       uint32_t chunksize;
+       Uint32 chunksize;
        readBytes(&chunksize, 4);
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Chunk size: %d\n", chunksize);
        fseek(_file, chunksize, SEEK_CUR);
@@ -107,7 +107,7 @@ void MIDIReader::skipTrack()
 
 void MIDIReader::readTrack(Track &tr, bool addbips)
 {
-       uint8_t temp[4];
+       Uint8 temp[4];
        //read the chunk ID
        fread((void *)(temp), 4, 1, _file);
 //      cerr << temp << endl;
@@ -118,7 +118,7 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
        }
 
        //read the chunk size
-       uint32_t chunksize;
+       Uint32 chunksize;
        readBytes(&chunksize, 4);
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Chunk size: %d\n", chunksize);
 
@@ -131,17 +131,17 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
 //              readBytes((char *)(&temp2),4);
 //              printf("TEMP : %0x %0x %0x %0x\n", temp2[0], temp2[1], temp2[2], temp2[3]);
        bool end = false;
-       uint8_t oldeventandchannel = 0;
-       uint32_t ticks = 0;
-       uint32_t timestamp = 0;
-       uint32_t currenttempo = 60000000/120;
+       Uint8 oldeventandchannel = 0;
+       Uint32 ticks = 0;
+       Uint32 timestamp = 0;
+       Uint32 currenttempo = 60000000/120;
 
        if (addbips)
                tr.addBip(0, 0);
 
 //      Track example;
        
-       uint32_t delta = 0;
+       Uint32 delta = 0;
        //Read the events
        while (_position < chunksize)
        {
@@ -153,9 +153,9 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                //add bips
                if (addbips)
                {
-                       uint32_t lastbiptick = 0;
+                       Uint32 lastbiptick = 0;
                        lastbiptick = tr.getBips()->back().getX();
-                       uint32_t temptimestamp = timestamp;
+                       Uint32 temptimestamp = timestamp;
                        //manage 1st bip, taking into account the time elapsed since the last event
                        if (lastbiptick > 0 && ticks >= lastbiptick + 480)
                        {
@@ -164,16 +164,16 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                                tr.addBip(lastbiptick, temptimestamp);
                        }
                        //add bips with the current tempo
-                       for (uint32_t i = lastbiptick + 480 ; i < ticks ; i += 480 )
+                       for (Uint32 i = lastbiptick + 480 ; i < ticks ; i += 480 )
                        {
                                temptimestamp += currenttempo / 1000;
                                tr.addBip(i, temptimestamp);
                        }
                }
 
-               timestamp += static_cast<uint32_t>(delta * (currenttempo / 480000.0));
+               timestamp += static_cast<Uint32>(delta * (currenttempo / 480000.0));
 
-               uint8_t eventandchannel, tempevt;
+               Uint8 eventandchannel, tempevt;
                // 4 bits for event type, and 4 others for the channel
                readBytes(&tempevt, 1);
                fseek(_file, -1, SEEK_CUR);
@@ -195,15 +195,15 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                {
                        if (end)
                                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "EXTRA EVT");
-                       uint8_t type;
+                       Uint8 type;
                        readBytes(&type, 1);
 
-                       uint32_t length;
-                       /*uint8_t nblus = */readVariableLength(length);
+                       Uint32 length;
+                       /*Uint8 nblus = */readVariableLength(length);
        
-                       uint8_t *data = new uint8_t[length];
+                       Uint8 *data = new Uint8[length];
                        readBytes(data, length);
-                       uint32_t tempo = 0;
+                       Uint32 tempo = 0;
        
                        switch(type)
                        {
@@ -247,18 +247,18 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                                        end = true;
                                        break;
                                case 0x51:
-                                       tempo = ((uint32_t(data[2] & 0x000000ff) << 16) + (uint32_t(data[1] & 0x000000ff) << 8) + uint32_t(data[0] & 0x000000ff));
+                                       tempo = ((Uint32(data[2] & 0x000000ff) << 16) + (Uint32(data[1] & 0x000000ff) << 8) + Uint32(data[0] & 0x000000ff));
                                        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Tempo at %d : x = %d = %d bpm\n", ticks, tempo, 60000000 / tempo);
                                        currenttempo = tempo;
                                        tr.addTempo(ticks, timestamp, tempo);
                                        break;
                                case 0x58:
                                        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Time signature at %d : %d|%d %d ticks %d x", 
-                                               ticks, uint8_t(data[3]), int(pow(float(2), uint8_t(data[2]))), int(data[1]), int(data[0]));
-                                       tr.addTimesignature(ticks, timestamp, uint8_t(data[3]));
+                                               ticks, Uint8(data[3]), int(pow(float(2), Uint8(data[2]))), int(data[1]), int(data[0]));
+                                       tr.addTimesignature(ticks, timestamp, Uint8(data[3]));
                                        break;
                                case 0x59:
-                                       SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Key signature: %d %d\n", uint8_t(data[1]), uint8_t(data[0]));
+                                       SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Key signature: %d %d\n", Uint8(data[1]), Uint8(data[0]));
                                        break;
                                case 0x7F:
                                        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Sequencer stuff!\n");
@@ -273,9 +273,9 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                else if ((eventandchannel & 0xf0) == 0xf0)// || (eventandchannel & 0xff) == 0xf7)
                {
                        //May be something else
-                       uint32_t length;
+                       Uint32 length;
                        readVariableLength(length);
-                       uint8_t *data = new uint8_t[length];
+                       Uint8 *data = new Uint8[length];
                        readBytes(data, length);
                        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "System data\n");
                        delete []data;
@@ -284,7 +284,7 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
                else
                {
 //                      printf("Evt : %x %x %x\n", eventandchannel & 0xf0, eventandchannel & 0x0f, eventandchannel);
-                       uint8_t par1, par2;
+                       Uint8 par1, par2;
 //                      position += 2;
 //                      char *notenames[] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
                        switch(eventandchannel & 0xf0)
@@ -346,19 +346,19 @@ void MIDIReader::readTrack(Track &tr, bool addbips)
        //these are needed if the notes track is longer than the time events track
        if (addbips)
        {
-               uint32_t lastbiptick = 0;
+               Uint32 lastbiptick = 0;
                if (!tr.getBips()->empty())
                        lastbiptick = tr.getBips()->back().getX();
-               uint32_t temptimestamp = timestamp;
+               Uint32 temptimestamp = timestamp;
                //manage 1st bip, taking into account the time elapsed since the last event
                if (lastbiptick > 0)
                {
                        lastbiptick += 480;
-                       temptimestamp = timestamp + static_cast<uint32_t>((lastbiptick - ticks) * (currenttempo / 480000.0));
+                       temptimestamp = timestamp + static_cast<Uint32>((lastbiptick - ticks) * (currenttempo / 480000.0));
                        tr.addBip(lastbiptick, temptimestamp);
                }
                //add 1000 bips with the current tempo
-               for (uint32_t i = lastbiptick ; i < lastbiptick + 480000 ; i += 480 )
+               for (Uint32 i = lastbiptick ; i < lastbiptick + 480000 ; i += 480 )
                {
                        tr.addBip(i, temptimestamp);
                        temptimestamp += currenttempo / 1000;
@@ -405,11 +405,11 @@ void MIDIReader::readTracks(Track &t)//, int &nb)
                SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Total : %d\n");
 }
 
-uint8_t MIDIReader::readVariableLength(uint32_t &nb)
+Uint8 MIDIReader::readVariableLength(Uint32 &nb)
 {
-       uint8_t nblus = 0;
+       Uint8 nblus = 0;
        nb = 0;
-       uint8_t temp;
+       Uint8 temp;
        do
        {
                fread((void *)(&temp), 1, 1, _file);
@@ -421,19 +421,19 @@ uint8_t MIDIReader::readVariableLength(uint32_t &nb)
        return nblus;
 }
 
-void MIDIReader::readBytes(void *data, uint32_t nb)
+void MIDIReader::readBytes(void *data, Uint32 nb)
 {
-       uint8_t *temp = new uint8_t[nb];
+       Uint8 *temp = new Uint8[nb];
        fread((void *)(temp), nb, 1, _file);
-       for (uint32_t i=0 ; i<nb ; i++)
-               ((uint8_t *)data)[i] = temp[nb - i - 1];
+       for (Uint32 i=0 ; i<nb ; i++)
+               ((Uint8 *)data)[i] = temp[nb - i - 1];
        delete []temp;
        _position += nb;
 }
 
-void MIDIReader::printBytes(uint8_t *data, uint32_t length)
+void MIDIReader::printBytes(Uint8 *data, Uint32 length)
 {
-       for (uint32_t i=0 ; i < length ; i++)
+       for (Uint32 i=0 ; i < length ; i++)
                cout << data[length - i - 1];
        cout << endl;
 }
index e07be39c5d60026f82a2c34a68a582b390ccb580..5d8396ea04d73594f061ba0aa81bb58724b62f53 100644 (file)
@@ -1,6 +1,6 @@
 #include "Metronome.hpp"\r
 \r
-Metronome::Metronome(const Track *track, uint32_t nbbeats, uint32_t tempo, bool activated)\r
+Metronome::Metronome(const Track *track, Uint32 nbbeats, Uint32 tempo, bool activated)\r
 :_track(track), _nbbeats(nbbeats), _tempo(tempo), _activated(activated)\r
 {\r
 }\r
index 9a9ac548d7341f56b69d105b857fc5280d4d07af..4ab0fda5114942113f3e145853f07f56225f4004 100644 (file)
@@ -2,20 +2,13 @@
 
 #include "Mixer.hpp"
 
-#ifdef WIN32
-#include <time.h>
-#include <windows.h>
-    extern struct { int tv_sec, tv_usec; } start;
-#else
-#include <sys/time.h>
-    extern struct timeval start;
-#endif
+extern Uint32 start;
 
 #define BIPLENGTH 10
 
 extern FILE*logfile;
 
-MetronomeAudio::MetronomeAudio(const Track *track, uint32_t nbbeats, uint32_t tempo, bool activated)
+MetronomeAudio::MetronomeAudio(const Track *track, Uint32 nbbeats, Uint32 tempo, bool activated)
 :Metronome(track, nbbeats, tempo, activated), thread(NULL)
 {
        Mixer::getInstance()->addSound("bip","bip10.wav");
@@ -39,37 +32,20 @@ int MetronomeAudio::thread_func(void *obj)
 
        SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
 
-       const list<Pair<uint32_t, uint32_t> > *bips = thismetronome->_track->getBips();
-       //const map<uint32_t, Pair<float, uint32_t> > *tempo = thismetronome->_track->getTempos();
-    const map<uint32_t, Pair<uint32_t, uint32_t> > *timesignatures = thismetronome->_track->getTimeSignatures();
-       static list<Pair<uint32_t, uint32_t> >::const_iterator cBips = bips->begin();
-       //static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTempo = tempo->begin();
-       static map<uint32_t, Pair<uint32_t, uint32_t> >::const_iterator cTimesignature = timesignatures->begin();
+       const list<Pair<Uint32, Uint32> > *bips = thismetronome->_track->getBips();
+       //const map<Uint32, Pair<float, Uint32> > *tempo = thismetronome->_track->getTempos();
+    const map<Uint32, Pair<Uint32, Uint32> > *timesignatures = thismetronome->_track->getTimeSignatures();
+       static list<Pair<Uint32, Uint32> >::const_iterator cBips = bips->begin();
+       //static map<Uint32, Pair<float, Uint32> >::const_iterator cTempo = tempo->begin();
+       static map<Uint32, Pair<Uint32, Uint32> >::const_iterator cTimesignature = timesignatures->begin();
 
        int currentbeat = 0;
-               
-#ifdef WIN32
-    struct { int tv_sec, tv_usec; } now;//, start;
-       DWORD t = timeGetTime ();
-/*    start.tv_sec = t / 1000;
-    start.tv_usec = (t % 1000) * 1000;*/
-#else
-    struct timeval now;/*, start;
-     gettimeofday(&start, NULL);*/
-#endif
-       uint32_t currenttime = 0;
+       Uint32 currenttime = 0;
        float lag = 0.0;
 
        while(thismetronome->_activated)
        {
-#ifdef WIN32
-               t = timeGetTime () + BIPLENGTH;
-               now.tv_sec = t / 1000;
-               now.tv_usec = (t % 1000) * 1000;
-#else
-               gettimeofday(&now, NULL);
-#endif
-               uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
+               Uint32 currenttime = SDL_GetTicks() - start;
 
                while (cBips != bips->end() && currenttime >= BIPTIMESTAMP(*cBips))
                {
index 26f921f5c4515d382bba013d01128b6d55cd06f8..70290ef9cb29a9a6af954f5fb0ac8e2db4118033 100644 (file)
@@ -3,21 +3,17 @@
 #include "Mixer.hpp"
 
 #ifdef WIN32
-#include <time.h>
-#include <windows.h>
-#include "SerialWindows.hpp"
-    extern struct { int tv_sec, tv_usec; } start;
+       #include "SerialWindows.hpp"
 #else
-#include <sys/time.h>
-#include "SerialLinux.hpp"
-    extern struct timeval start;
+       #include "SerialLinux.hpp"
 #endif
+extern Uint32 start;
 
 #define BEFOREDELAY 2000
 
 extern FILE *logfile;
 
-MetronomeHaptic::MetronomeHaptic(const Track *track, uint32_t nbbeats, uint32_t tempo, bool activated)
+MetronomeHaptic::MetronomeHaptic(const Track *track, Uint32 nbbeats, Uint32 tempo, bool activated)
 :Metronome(track, nbbeats, tempo, activated), thread(NULL)
 {
        try
@@ -41,45 +37,20 @@ MetronomeHaptic::MetronomeHaptic(const Track *track, uint32_t nbbeats, uint32_t
        _comport->WriteData(buffer1, 3);
        _comport->WriteData(buffer2, 6);
 \r
-/*     char INBUFFER[128];\r
-       memset(INBUFFER, 0, 128);
-       int nbread = _comport->ReadData(INBUFFER, 128);
-       stringstream s;
-       s << nbread << " read:\n" << INBUFFER << endl;
-       OutputDebugString(s.str().c_str());*/\r
-       \r
        //Tacton 2\r
        buffer2[0] = 0x02;                                      //pattern\r
        _comport->WriteData(buffer1, 3);
        _comport->WriteData(buffer2, 6);
-
-/*     memset(INBUFFER, 0, 128);
-       nbread = _comport->ReadData(INBUFFER, 128);
-       stringstream s2;
-       s2 << nbread << " read:\n" << INBUFFER << endl;
-       OutputDebugString(s2.str().c_str());*/
-       \r
+\r
        //Tacton 3\r
        buffer2[0] = 0x04;                                      //pattern\r
        _comport->WriteData(buffer1, 3);
        _comport->WriteData(buffer2, 6);
-       
-/*     memset(INBUFFER, 0, 128);
-       nbread = _comport->ReadData(INBUFFER, 128);
-       stringstream s3;
-       s3 << nbread << " read:\n" << INBUFFER << endl;
-       OutputDebugString(s3.str().c_str());*/
-       
+
        //Tacton 4\r
        buffer2[0] = 0x08;                                      //pattern\r
        _comport->WriteData(buffer1, 3);
        _comport->WriteData(buffer2, 6);
-
-/*     memset(INBUFFER, 0, 128);
-       nbread = _comport->ReadData(INBUFFER, 128);
-       stringstream s4;
-       s4 << nbread << " read:\n" << INBUFFER << endl;
-       OutputDebugString(s4.str().c_str());*/
 }
 
 MetronomeHaptic::~MetronomeHaptic()
@@ -90,51 +61,14 @@ MetronomeHaptic::~MetronomeHaptic()
        SDL_WaitThread(thread, NULL);
 }
 
-void MetronomeHaptic::setTempo(uint32_t tempo)\r
+void MetronomeHaptic::setTempo(Uint32 tempo)\r
 {\r
        Metronome::setTempo(tempo);\r
-       //send info to Serial Port\r
-       //char outBuffer[5];\r
-       /*char outBuffer[5];// = {'T', 'A', 'B', 'C', 'D'};\r
-       memset(outBuffer, 0, 5);
-       sprintf(OUTBUFFER, "T%3d\n", 60000000/tempo);\r
-       outBuffer[0] = 'T';\r
-       outBuffer[1] = (tempo & 0xff000000) >> 24;\r
-       outBuffer[2] = (tempo & 0x00ff0000) >> 16;\r
-       outBuffer[3] = (tempo & 0x0000ff00) >> 8;\r
-       outBuffer[4] = tempo & 0x000000ff;\r
-       
-       bool written = _comport->WriteData(outBuffer, 5);\r
-       
-       char INBUFFER[128];\r
-       memset(INBUFFER, 0, 128);
-       int nbread = _comport->ReadData(INBUFFER, 128);
-                       stringstream s;
-                       s << nbread << " read:\n" << INBUFFER << endl;
-                       OutputDebugString(s.str().c_str());*/
 }\r
 
-void MetronomeHaptic::setNbBeats(uint32_t nbbeats)
+void MetronomeHaptic::setNbBeats(Uint32 nbbeats)
 {
        Metronome::setNbBeats(nbbeats);\r
-       //send info to Serial Port\r
-/*     char outBuffer[5];// = {'B', '5', '6', '7', '8'};\r
-       memset(outBuffer, 0, 5);
-       sprintf(OUTBUFFER, "B%3d\n", nbbeats);\r
-       outBuffer[0] = 'B';\r
-       outBuffer[1] = (nbbeats & 0xff000000) >> 24;\r
-       outBuffer[2] = (nbbeats & 0x00ff0000) >> 16;\r
-       outBuffer[3] = (nbbeats & 0x0000ff00) >> 8;\r
-       outBuffer[4] = nbbeats & 0x000000ff;\r
-       \r
-       bool written = _comport->WriteData(outBuffer, 5);\r
-
-       char INBUFFER[128];\r
-       memset(INBUFFER, 0, 128);
-       int nbread = _comport->ReadData(INBUFFER, 128);
-                       stringstream s;
-                       s << nbread << " read:\n" << INBUFFER << endl;
-                       OutputDebugString(s.str().c_str());*/
 }
 
 void MetronomeHaptic::run()
@@ -148,23 +82,12 @@ int MetronomeHaptic::thread_func(void *obj)
 
        SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
 
-       const list<Pair<uint32_t, uint32_t> > *bips = thismetronome->_track->getBips();
-       //const map<uint32_t, Pair<float, uint32_t> > *tempo = thismetronome->_track->getTempos();
-    const map<uint32_t, Pair<uint32_t, uint32_t> > *timesignatures = thismetronome->_track->getTimeSignatures();
-       static list<Pair<uint32_t, uint32_t> >::const_iterator cBips = bips->begin();
-       //static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTempo = tempo->begin();
-       static map<uint32_t, Pair<uint32_t, uint32_t> >::const_iterator cTimesignature = timesignatures->begin();
-
-#ifdef WIN32
-    struct { int tv_sec, tv_usec; } now;//, start
-       DWORD t = timeGetTime () + BEFOREDELAY;
-/*    start.tv_sec = t / 1000;
-    start.tv_usec = (t % 1000) * 1000;*/
-#else
-    struct timeval now;/*, start;
-     gettimeofday(&start, NULL);*/
-#endif*/
-       //float currenttime = 0;
+       const list<Pair<Uint32, Uint32> > *bips = thismetronome->_track->getBips();
+       //const map<Uint32, Pair<float, Uint32> > *tempo = thismetronome->_track->getTempos();
+    const map<Uint32, Pair<Uint32, Uint32> > *timesignatures = thismetronome->_track->getTimeSignatures();
+       static list<Pair<Uint32, Uint32> >::const_iterator cBips = bips->begin();
+       //static map<Uint32, Pair<float, Uint32> >::const_iterator cTempo = tempo->begin();
+       static map<Uint32, Pair<Uint32, Uint32> >::const_iterator cTimesignature = timesignatures->begin();
 
        bool written = thismetronome->_comport->WriteData("S", 1);
        unsigned char outBuffer[6];
@@ -173,14 +96,7 @@ int MetronomeHaptic::thread_func(void *obj)
 
        while(thismetronome->_activated)
        {
-#ifdef WIN32
-               t = timeGetTime () + BEFOREDELAY;
-               now.tv_sec = t / 1000;
-               now.tv_usec = (t % 1000) * 1000;
-#else
-               gettimeofday(&now, NULL);
-#endif
-               uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
+               Uint32 currenttime = SDL_GetTicks() - start;
 
                while (cBips != bips->end() && currenttime >= BIPTIMESTAMP(*cBips))
                {
@@ -241,10 +157,10 @@ int MetronomeHaptic::thread_func(void *obj)
 
        SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
 
-       const map<uint32_t, Pair<float, uint32_t> > *tempo = thismetronome->_track->getTempos();
-    const map<uint32_t, Pair<float, uint32_t> > *timesignatures = thismetronome->_track->getTimeSignatures();
-       static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTempo = tempo->begin();
-       static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTimesignature = timesignatures->begin();
+       const map<Uint32, Pair<float, Uint32> > *tempo = thismetronome->_track->getTempos();
+    const map<Uint32, Pair<float, Uint32> > *timesignatures = thismetronome->_track->getTimeSignatures();
+       static map<Uint32, Pair<float, Uint32> >::const_iterator cTempo = tempo->begin();
+       static map<Uint32, Pair<float, Uint32> >::const_iterator cTimesignature = timesignatures->begin();
                
 #ifdef WIN32
     struct { int tv_sec, tv_usec; } now, start;
index 40dbbfd834f77982824a6d113c385dee063f63c5..e2b3b27b5b982955e52292b3499756534ea26059 100644 (file)
@@ -5,22 +5,23 @@
 #include "Metronome.hpp"
 #include "MetronomeAudio.hpp"
 #include "MetronomeHaptic.hpp"
+#include "Tools.hpp"
 
 #include <GL/glew.h>
 #include <SDL/SDL.h>
 #include <SDL/SDL_mixer.h>
 #include <SDL/SDL_image.h>
 
-#ifdef WIN32
-    struct { int tv_sec, tv_usec; } start;
-#else
-    struct timeval start;
-#endif
+#define KEY(X) ((keystate[(X)]) != 0)
+
+extern GameType gametype;
+
+Uint32 start;
 
 #include <iostream>
 using namespace std;
 
-int VIEWLENGTH = 250;
+GLfloat VIEWLENGTH = 250.f;
 extern float SECONDSIZE;
 float posz = 0;
 Texture *texturebois, *texturefond, *texturesteel, *texturefrett;
@@ -211,7 +212,7 @@ void initPaint()
 
 void draw(const Track &t, char diff)
 {
-#ifdef WIN32
+/*#ifdef WIN32
     struct { int tv_sec, tv_usec; } now;
     DWORD tim = timeGetTime ();
     now.tv_sec = tim / 1000;
@@ -219,8 +220,9 @@ void draw(const Track &t, char diff)
 #else
     struct timeval now;
      gettimeofday(&now, NULL);
-#endif
-       uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
+#endif*/
+       Uint32 currenttime = SDL_GetTicks() - start;
+       //(now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
 
        posz = -SECONDSIZE * currenttime;
 
@@ -286,14 +288,14 @@ void draw(const Track &t, char diff)
                glBegin(GL_QUADS);
                        glColor3f(0.2f, 0.2f, 0.2f);
                        glNormal3f(0, 1, 0);
-                       glVertex3f(NOTEDIST*(i-2), 0, 1);
-                       glVertex3f(NOTEDIST*(i-2)+.1f, 0.2f, 1);
-                       glVertex3f(NOTEDIST*(i-2)+.1f, 0.2f,-VIEWLENGTH);
-                       glVertex3f(NOTEDIST*(i-2), 0, -VIEWLENGTH);
-                       glVertex3f(NOTEDIST*(i-2)+.1f, 0.2f, 1);
-                       glVertex3f(NOTEDIST*(i-2)+.2f, 0, 1);
-                       glVertex3f(NOTEDIST*(i-2)+.2f, 0,-VIEWLENGTH);
-                       glVertex3f(NOTEDIST*(i-2)+.1f, 0.2f, -VIEWLENGTH);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2)), 0.f, 1.f);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.1f, 0.2f, 1.f);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.1f, 0.2f,-VIEWLENGTH);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2)), 0, -VIEWLENGTH);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.1f, 0.2f, 1.f);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.2f, 0.f, 1.f);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.2f, 0.f, -VIEWLENGTH);
+                       glVertex3f(GLfloat(NOTEDIST*(i-2))+.1f, 0.2f, -VIEWLENGTH);
                glEnd();
        }
        //Draw the sides
@@ -448,7 +450,7 @@ void drawLong(float pos, float size, float length, float colorx, float colory, f
        glEnd();                                                // Done Drawing The Quad
 }
 
-void handleKeyOn(keys k, uint32_t currenttime)
+void handleKeyOn(keys k, Uint32 currenttime)
 {
        fromKeyboard.addKey(k);
 /*     switch(k)
@@ -471,7 +473,7 @@ void handleKeyOn(keys k, uint32_t currenttime)
        }*/
 }
 
-void handleKeyOff(keys k, uint32_t currenttime)
+void handleKeyOff(keys k, Uint32 currenttime)
 {
 //     fromKeyboard.remKey(k);
        if (fromKeyboard.getTimestamp() == -1)
@@ -484,14 +486,26 @@ void handleKeyOff(keys k, uint32_t currenttime)
        fromKeyboard.setEndTimestamp(-1);
 }
 
-void handleKeys(bool a, bool b, bool c, bool d, bool e, uint32_t currenttime)
+void handleKeys(bool a, bool b, bool c, bool d, bool e, Uint32 currenttime)
 {
-       if (fromKeyboard.isNone())
-               fromKeyboard.setTimestamp(-1);
-       fromKeyboard.setKeys(a, b, c, d, e);
+       if (gametype == REGULAR)
+       {
+               if (fromKeyboard.isNone())
+                       fromKeyboard.setTimestamp(-1);
+               fromKeyboard.setKeys(a, b, c, d, e);
+       }
+       else if (gametype == SPEEDACCURACY)
+       {
+               fromKeyboard.setKeys(a, b, c, d, e);
+               if (fromKeyboard.getTimestamp() != currenttime)
+               {
+                       fromKeyboard.setTimestamp(currenttime);
+                       fromKeyboard.log("Play", logfile);
+               }
+       }
 }
 
-void handleStrokeOn(uint32_t currenttime)
+void handleStrokeOn(Uint32 currenttime)
 {
        if (fromKeyboard.getTimestamp() != -1)
        {
@@ -503,13 +517,13 @@ void handleStrokeOn(uint32_t currenttime)
        fromKeyboard.setEndTimestamp(-1);
 }
 
-void handleStrokeOff(uint32_t currenttime)
+void handleStrokeOff(Uint32 currenttime)
 {
 }
 
 bool processEvents()
 {
-#ifdef WIN32
+/*#ifdef WIN32
     struct { int tv_sec, tv_usec; } now;
     DWORD tim = timeGetTime ();
     now.tv_sec = tim / 1000;
@@ -517,8 +531,9 @@ bool processEvents()
 #else
     struct timeval now;
      gettimeofday(&now, NULL);
-#endif
-       uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
+#endif*/
+       Uint32 currenttime = SDL_GetTicks() - start;
+       //(now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
 
   SDL_Event event;
 //   bool quitProgram = false;
@@ -535,7 +550,10 @@ bool processEvents()
                        case SDL_KEYDOWN:
 #if SDL_VERSION_ATLEAST(1,3,0)
                                keystate = SDL_GetKeyboardState(NULL);
-                               handleKeys(keystate[SDL_SCANCODE_F1], keystate[SDL_SCANCODE_F2], keystate[SDL_SCANCODE_F3], keystate[SDL_SCANCODE_F4], keystate[SDL_SCANCODE_F5], currenttime);
+                               if (gametype == REGULAR)
+                                       handleKeys(KEY(SDL_SCANCODE_F1), KEY(SDL_SCANCODE_F2),KEY(SDL_SCANCODE_F3), KEY(SDL_SCANCODE_F4), KEY(SDL_SCANCODE_F5), currenttime);
+                               else if (gametype == SPEEDACCURACY)
+                                       handleKeys(KEY(SDL_SCANCODE_A), KEY(SDL_SCANCODE_S), false, KEY(SDL_SCANCODE_K), KEY(SDL_SCANCODE_L), currenttime);
 #else
                                keystate = SDL_GetKeyState(NULL);
                                handleKeys(keystate[SDLK_F1], keystate[SDLK_F2], keystate[SDLK_F3], keystate[SDLK_F4], keystate[SDLK_F5], currenttime);
@@ -583,7 +601,7 @@ bool processEvents()
                                                handleStrokeOn(currenttime);
                                                break;
                                        case SDLK_RCTRL:
-                                               if (logfile)
+                                               if (logfile && gametype == TOMSLAW)
                                                        fprintf(logfile, "PRESS;%d\n", currenttime);
                                                break;
                                        default:
@@ -617,7 +635,10 @@ bool processEvents()
                                }
 #if SDL_VERSION_ATLEAST(1,3,0)
                                keystate = SDL_GetKeyboardState(NULL);
-                               handleKeys(keystate[SDL_SCANCODE_F1], keystate[SDL_SCANCODE_F2], keystate[SDL_SCANCODE_F3], keystate[SDL_SCANCODE_F4], keystate[SDL_SCANCODE_F5], currenttime);
+                               if (gametype == REGULAR)
+                                       handleKeys(KEY(SDL_SCANCODE_F1), KEY(SDL_SCANCODE_F2),KEY(SDL_SCANCODE_F3), KEY(SDL_SCANCODE_F4), KEY(SDL_SCANCODE_F5), currenttime);
+                               else if (gametype == SPEEDACCURACY)
+                                       handleKeys(KEY(SDL_SCANCODE_A), KEY(SDL_SCANCODE_S), false, KEY(SDL_SCANCODE_K), KEY(SDL_SCANCODE_L), currenttime);
 #else
                                keystate = SDL_GetKeyState(NULL);
                                handleKeys(keystate[SDLK_F1], keystate[SDLK_F2], keystate[SDLK_F3], keystate[SDLK_F4], keystate[SDLK_F5], currenttime);
@@ -669,21 +690,24 @@ void loop(const Track &tr, const String &songname)
 
        SDL_LogDebug(SDL_LOG_CATEGORY_SYSTEM, "Init paint\n");
        initPaint();
-       Mixer::getInstance()->loadMusic(songname + "/tout.ogg");
+       if (gametype == REGULAR)
+               Mixer::getInstance()->loadMusic(songname + "/tout.ogg");
 
 //must be done before paint and metronomes
-#ifdef WIN32
+       start = SDL_GetTicks();
+/*#ifdef WIN32
     DWORD t = timeGetTime ();
     start.tv_sec = t / 1000;
     start.tv_usec = (t % 1000) * 1000;
 #else
      gettimeofday(&start, NULL);
-#endif
+#endif*/
 
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "LET'S ROCK!\n");
        //m->setActive(true);
 
-       Mixer::getInstance()->playMusic();
+       if (gametype == REGULAR)
+               Mixer::getInstance()->playMusic();
        if (m)
                m->run();
 /*     Mixer::getInstance()->playSound("guitar");
@@ -711,18 +735,6 @@ void loop(const Track &tr, const String &songname)
 
   while(!quitProgram)
   {
-/*     //compute current time in the loop
-#ifdef WIN32
-    struct { int tv_sec, tv_usec; } now;
-    DWORD tim = timeGetTime ();
-    now.tv_sec = tim / 1000;
-    now.tv_usec = (tim % 1000) * 1000;
-#else
-    struct timeval now;
-     gettimeofday(&now, NULL);
-#endif
-       uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
-       */
        //              cout << "draw" << endl;
     draw(tr, NORMAL);
 //             cout << "events" << endl;
@@ -732,7 +744,6 @@ void loop(const Track &tr, const String &songname)
 //             cout << "pause" << endl;
     SDL_Delay(10);
        // check metronome events
-//     tr.checkMetronome(currenttime, m);
   }
 
   delete m;
index 3c115a903110687fc3ad3b244e0bc58fa137dc57..b5295a0301a23f09efec05402e79c6bdd33507de 100644 (file)
@@ -14,25 +14,25 @@ using namespace std;
 extern Texture* texturesteel, *texturefrett;
 extern FILE *logfile;
 extern float SECONDSIZE;
-extern int VIEWLENGTH;
+extern GLfloat VIEWLENGTH;
 
 Track::Track()
 :/*_currenttempo(120)*,_currentpos(0),*/ _trackSize(0), _active(true)
 {
-  for (uint8_t i = 0 ; i < NBDIFFICULTIES ; i++)
+  for (Uint8 i = 0 ; i < NBDIFFICULTIES ; i++)
   {
-    _currentconfig[i] = (uint8_t) 0;
+    _currentconfig[i] = (Uint8) 0;
     _nbnotes[i] = 0;
     _totallength[i] = 0;
   }
-  for (uint8_t i = 0 ; i < 128 ; i++)
+  for (Uint8 i = 0 ; i < 128 ; i++)
     _totalnotes[i] = 0;
 }
 
 Track::Track(const Track &tr)
 {
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "WARNING: COPYING THE TRACK!\n");
-       for (uint8_t i = 0 ; i < NBDIFFICULTIES ; i++)
+       for (Uint8 i = 0 ; i < NBDIFFICULTIES ; i++)
        {
                _notes[i] = tr._notes[i];
                _currentconfig[i] = tr._currentconfig[i];
@@ -46,14 +46,14 @@ Track::Track(const Track &tr)
        tempo: beats per minute
        duration: track length in ms
 */
-Track::Track(uint32_t tempo, uint32_t duration)
+Track::Track(Uint32 tempo, Uint32 duration)
 {
-       uint32_t t = 60000000 / tempo;
+       Uint32 t = 60000000 / tempo;
        addTempo(0, 0, tempo);
        addTimesignature(0, 0, 1);
 
-       for (uint32_t i = 0 ; i < (duration * 1000) / t ; i++)
-               _bips.push_back(Pair<uint32_t, uint32_t>(i, i * t / 1000 + 2000));
+       for (Uint32 i = 0 ; i < (duration * 1000) / t ; i++)
+               _bips.push_back(Pair<Uint32, Uint32>(i, i * t / 1000 + 2000));
 }
 
 /**
@@ -63,16 +63,16 @@ Track::Track(uint32_t tempo, uint32_t duration)
        nbspeeds: number of speeds
        speeds: 
 */
-Track::Track(uint8_t nbbuttons, uint8_t repetitions, uint8_t nbspeeds, uint32_t *speeds)
+Track::Track(Uint8 nbbuttons, Uint8 repetitions, Uint8 nbspeeds, Uint32 *speeds)
 {
-       uint32_t tick = 0, timestamp = 2000;
+       Uint32 tick = 0, timestamp = 2000;
        addTimesignature(0, 0, 1);
 
        for (int n = 0 ; n < nbspeeds ; n++)
        {
-               uint32_t tempo = 60000000 / speeds[n];
+               Uint32 tempo = 60000000 / speeds[n];
                addTempo(tick, timestamp, tempo);
-               vector<uint8_t> configs;
+               vector<Uint8> configs;
 
                //creates a block with repetitions of all the patterns (excluding the empty pattern)
                for (int i = 1 ; i < (int)pow(2.0, (double)nbbuttons) ; i++)
@@ -83,9 +83,9 @@ Track::Track(uint8_t nbbuttons, uint8_t repetitions, uint8_t nbspeeds, uint32_t
                random_shuffle(configs.begin(), configs.end());
 
                //add the permutation to the note list
-               for (vector<uint8_t>::iterator it = configs.begin() ; it != configs.end() ; it++)
+               for (vector<Uint8>::iterator it = configs.begin() ; it != configs.end() ; it++)
                {
-                       uint8_t cfg = ((*it) & 0x03) | (((*it) & 0x0c) << 1);
+                       Uint8 cfg = ((*it) & 0x03) | (((*it) & 0x0c) << 1);
                        for (int d=0 ; d < NBDIFFICULTIES ; d++)
                                _notes[d][tick] = Config(cfg, timestamp, timestamp+100, tick, 1);
                        tick++;
@@ -139,13 +139,13 @@ Track::~Track()
   108: vocal track (C)
 */
 
-void Track::addKey(uint32_t time, uint8_t note)
+void Track::addKey(Uint32 time, Uint8 note)
 {
 //   _totalnotes[note]++;
 
 //   cout << "addkey begin" << endl;
-  uint8_t difficulty = note / 12 - 5;
-  uint8_t key = note % 12;
+  Uint8 difficulty = note / 12 - 5;
+  Uint8 key = note % 12;
 //   cout << "+ diff=" << difficulty+0 << " key=" << key+0 << " note=" << note+0 << endl;  //could be note 108 for singer
   if (difficulty >= NBDIFFICULTIES || difficulty < 0)
   {
@@ -199,12 +199,12 @@ void Track::addKey(uint32_t time, uint8_t note)
 //   cout << "addkey end" << endl;
 }
 
-void Track::remKey(uint32_t time, uint8_t note)
+void Track::remKey(Uint32 time, Uint8 note)
 {
        _totalnotes[note]++;
 //   cout << "remkey begin" << endl;
-  uint8_t difficulty = note / 12 - 5;
-  uint8_t key = note % 12;
+  Uint8 difficulty = note / 12 - 5;
+  Uint8 key = note % 12;
 //   cout << "- diff=" << difficulty+0 << " key=" << key+0 << " note=" << note+0 << endl;
   if (difficulty >= NBDIFFICULTIES || difficulty + 0 < 0)
   {
@@ -221,9 +221,9 @@ void Track::remKey(uint32_t time, uint8_t note)
        {
                _currentconfig[difficulty].setTicks(time - _currentconfig[difficulty].getTime());
                //compute the note duration and position
-               uint32_t currenttempo = 0, lasttick = 0;
-               map<uint32_t, Pair<uint32_t, uint32_t> >::iterator ti = _tempo.begin();
-               uint32_t tickpos = _currentconfig[difficulty].getTime();
+               Uint32 currenttempo = 0, lasttick = 0;
+               map<Uint32, Pair<Uint32, Uint32> >::iterator ti = _tempo.begin();
+               Uint32 tickpos = _currentconfig[difficulty].getTime();
                while (ti != _tempo.end() && TICK(*ti) <= tickpos)
                {
 //                     _currentconfig[difficulty].setPosition(_currentconfig[difficulty].getPosition() + (TICK(*ti) - lasttick) * (currenttempo / 480000.0));
@@ -234,7 +234,7 @@ void Track::remKey(uint32_t time, uint8_t note)
                }
                if (tickpos > lasttick)
                {
-                       uint32_t delta =  static_cast<uint32_t>((tickpos - lasttick) * (currenttempo / 480000.0));
+                       Uint32 delta =  static_cast<Uint32>((tickpos - lasttick) * (currenttempo / 480000.0));
                        _currentconfig[difficulty].setTimestamp(_currentconfig[difficulty].getTimestamp() + delta);
                }
                
@@ -243,7 +243,7 @@ void Track::remKey(uint32_t time, uint8_t note)
                {
                        if (ti != _tempo.end() && TICK(*ti) < time)
                        {
-                               uint32_t delta =  static_cast<uint32_t>((TICK(*ti) - tickpos) * (currenttempo / 480000.0));
+                               Uint32 delta =  static_cast<Uint32>((TICK(*ti) - tickpos) * (currenttempo / 480000.0));
                                _currentconfig[difficulty].setEndTimestamp(_currentconfig[difficulty].getTimestamp() + delta);
                                _currentconfig[difficulty].setEndTimestamp(TIMESTAMP(*ti));
                                tickpos = TICK(*ti);
@@ -252,7 +252,7 @@ void Track::remKey(uint32_t time, uint8_t note)
                        }
                        else
                        {
-                               uint32_t delta =  static_cast<uint32_t>((time - tickpos) * (currenttempo / 480000.0));
+                               Uint32 delta =  static_cast<Uint32>((time - tickpos) * (currenttempo / 480000.0));
                                _currentconfig[difficulty].setEndTimestamp(_currentconfig[difficulty].getTimestamp() + delta);
                                tickpos = time;
                        }
@@ -303,21 +303,21 @@ void Track::remKey(uint32_t time, uint8_t note)
 //   cout << "remkey end" << endl;
 }
 
-Config Track::getNote(uint32_t pos, uint8_t difficulty)
+Config Track::getNote(Uint32 pos, Uint8 difficulty)
 {
        if (_notes[difficulty].count(pos) == 0)
                throw 0;
        return _notes[difficulty][pos];
 }
 
-uint32_t Track::getTempo(uint32_t pos)
+Uint32 Track::getTempo(Uint32 pos)
 {
        if (_tempo.count(pos) == 0)
                throw 0;
        return _tempo[pos].getY();
 }
 
-uint32_t Track::getTimeSignature(uint32_t pos)
+Uint32 Track::getTimeSignature(Uint32 pos)
 {
        if (_timesignatures.count(pos) == 0)
                throw 0;
@@ -328,9 +328,9 @@ uint32_t Track::getTimeSignature(uint32_t pos)
 void Track::computeBips()
 {
        double pos = 0;
-       uint32_t currenttempo = 120;
-       map<uint32_t,uint32_t>::iterator p = _tempo.begin();
-       for (uint32_t i = 0 ; i < getEndOfTrack() ; i += 480)
+       Uint32 currenttempo = 120;
+       map<Uint32,Uint32>::iterator p = _tempo.begin();
+       for (Uint32 i = 0 ; i < getEndOfTrack() ; i += 480)
        {
                //cout << "Bip @ " << pos << endl;
                _bips.push_back(pos);
@@ -349,10 +349,10 @@ void Track::computeBips()
 void Track::displayTracks()
 {
        cout << "TRACK:" << endl;
-       for (uint8_t k=0 ; k < NBDIFFICULTIES ; k++)
+       for (Uint8 k=0 ; k < NBDIFFICULTIES ; k++)
        {
                cout << "Difficulty " << (k+0) << ":" << endl;
-               for(map<uint32_t,Config>::iterator i = _notes[k].begin(); i != _notes[k].end(); ++i)
+               for(map<Uint32,Config>::iterator i = _notes[k].begin(); i != _notes[k].end(); ++i)
                        cout << (*i).first << ": " << (*i).second << endl;
        }
 }
@@ -360,14 +360,14 @@ void Track::displayTracks()
 void Track::debugTempo()
 {
    cout << "Tempo changes: " << endl;
-   for( map<uint32_t, Pair<uint32_t, uint32_t> >::iterator ii=_tempo.begin(); ii!=_tempo.end(); ++ii)
+   for( map<Uint32, Pair<Uint32, Uint32> >::iterator ii=_tempo.begin(); ii!=_tempo.end(); ++ii)
        cout << TICK(*ii) << ": " << TIMESTAMP(*ii) << " (" << VALUE(*ii) << ")" << endl;
           //ticksToBeats((*ii).second) << ")" << endl;
 }
 
-void Track::drawFrets(uint32_t postime) const
+void Track::drawFrets(Uint32 postime) const
 {
-       static list<Pair<uint32_t, uint32_t> >::const_iterator startingbips = _bips.begin();
+       static list<Pair<Uint32, Uint32> >::const_iterator startingbips = _bips.begin();
        
 // on avance tant que les bips sont dépassées
        while (startingbips != _bips.end() && BIPTIMESTAMP(*startingbips) < postime)
@@ -378,7 +378,7 @@ void Track::drawFrets(uint32_t postime) const
                startingbips++;
        }
 
-       list<Pair<uint32_t, uint32_t> >::const_iterator b = startingbips;
+       list<Pair<Uint32, Uint32> >::const_iterator b = startingbips;
 
        glMatrixMode(GL_MODELVIEW);
        //glDisable(GL_DEPTH_TEST);
@@ -415,9 +415,9 @@ void Track::drawFrets(uint32_t postime) const
        }
 }
 
-void Track::drawNotes(uint32_t postime, uint8_t diff) const
+void Track::drawNotes(Uint32 postime, Uint8 diff) const
 {
-       static map<uint32_t,Config>::const_iterator startingn = _notes[diff].begin();
+       static map<Uint32,Config>::const_iterator startingn = _notes[diff].begin();
        static double startingpos = 0.0;
 
 //     cout << "startingpos=" << startingpos << " postime=" << postime << " first note at " << (*startingn).first << ":" << (*startingn).second.getPosition() << endl;
@@ -435,7 +435,7 @@ void Track::drawNotes(uint32_t postime, uint8_t diff) const
                startingn++;
        }
 
-       map<uint32_t,Config>::const_iterator n = startingn;
+       map<Uint32,Config>::const_iterator n = startingn;
        
        glMatrixMode(GL_MODELVIEW);
        //on dessine les notes jusqu'à 10s
@@ -451,8 +451,8 @@ void Track::drawNotes(uint32_t postime, uint8_t diff) const
 /*
 void Track::checkMetronome(float postime, Metronome *m) const
 {
-       static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTempo = _tempo.begin();
-       static map<uint32_t, Pair<float, uint32_t> >::const_iterator cTimesignature = _timesignatures.begin();
+       static map<Uint32, Pair<float, Uint32> >::const_iterator cTempo = _tempo.begin();
+       static map<Uint32, Pair<float, Uint32> >::const_iterator cTimesignature = _timesignatures.begin();
        static double startingpos = 0.0;
 
        // on avance tant que les tempos sont dépassées
index eb500d915906db32e1f57ef1e09c58c874fb3aa6..328537b1e7180fa6728be114483daef1f3310597 100644 (file)
@@ -6,11 +6,7 @@ using namespace std;
 #define MAX(X,Y) (((X)>(Y))?(X):(Y))
 #define MIN(X,Y) (((X)<(Y))?(X):(Y))
 
-#ifdef WIN32
-    extern struct { int tv_sec, tv_usec; } start;
-#else
-    extern struct timeval start;
-#endif
+extern Uint32 start;
 
 Wiimote::Wiimote(int nb)
 :_wiimotes(wiiuse_init(nb)), _nb(nb), _strumstate(false)
@@ -44,7 +40,7 @@ Wiimote::Wiimote(int nb)
        }
 
 }
-void Wiimote::handleKey(guitar_hero_3_t* gh3, int key, int button, uint32_t currenttime)
+void Wiimote::handleKey(guitar_hero_3_t* gh3, int key, int button, Uint32 currenttime)
 {
        if (_keystate[key])
        {
@@ -62,16 +58,7 @@ void Wiimote::handleKey(guitar_hero_3_t* gh3, int key, int button, uint32_t curr
 
 void Wiimote::handleEvents()
 {
-#ifdef WIN32
-    struct { int tv_sec, tv_usec; } now;
-    DWORD tim = timeGetTime ();
-    now.tv_sec = tim / 1000;
-    now.tv_usec = (tim % 1000) * 1000;
-#else
-    struct timeval now;
-     gettimeofday(&now, NULL);
-#endif
-       uint32_t currenttime = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
+       Uint32 currenttime = SDL_GetTicks() - start;
 
        if (!wiiuse_poll(_wiimotes, _nb))
                return;
index 6f6b4b8b658c42915c8a0dc9d2e811ab2340ca67..44dd25cf2d81885b53ac1ced84e76fb8c866a21c 100644 (file)
@@ -4,6 +4,7 @@
 #include "Track.hpp"
 #include "Mixer.hpp"
 #include "PaintGame.h"
+#include "Tools.hpp"
 
 #ifdef WIN32
 #include <time.h>
@@ -15,6 +16,7 @@
 #include <SDL/SDL.h>
 #include <SDL/SDL_log.h>
 
+GameType gametype;
 
 #ifdef WIN32
 #include <time.h>
@@ -47,7 +49,7 @@ int main(int argc, char *argv[])
 
        time_t tim = time(NULL);
        struct tm *t  = gmtime(&tim);
-
+       
        SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
 
        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Loading song\n");
@@ -60,6 +62,7 @@ int main(int argc, char *argv[])
        // v5 = distance
        if (argc >= 6)
        {
+               gametype = TOMSLAW;
                Track tr(atoi(argv[3]), atoi(argv[4]));
                SECONDSIZE = atof(argv[5]);
 
@@ -79,7 +82,9 @@ int main(int argc, char *argv[])
        // v4 = nbrepetitions
        else if (argc >= 5)
        {
-               uint32_t speeds[] = {40, 80, 120, 160, 200};
+               gametype = SPEEDACCURACY;
+
+               Uint32 speeds[] = {40, 80, 120, 160, 200};
                Track tr(atoi(argv[3]), atoi(argv[4]), 5, speeds);
                SECONDSIZE = 0.08;
 
@@ -93,6 +98,8 @@ int main(int argc, char *argv[])
        }
        else
        {
+               gametype = REGULAR;
+
                if (argc >= 3)
                {
                        String logfilename = String(argv[1]) + "-" + String(argv[2]) + "-" + String(1900 + t->tm_year) + "-" + String(t->tm_mon) + "-" + String(t->tm_mday) + "-" + String(t->tm_hour) + "-" + String(t->tm_min) + "-" + String(t->tm_sec);