Permalink
Browse files

Merge branch 'master' of http://github.com/wolfwood/AsciiAsciiRevolution

  • Loading branch information...
Jackie Kircher
Jackie Kircher committed Oct 24, 2010
2 parents cfe4fb9 + ef3c2b4 commit c5ccf770cde9ab8d45707a49d63b9a06779e72a8
Showing with 52 additions and 58 deletions.
  1. +3 −1 AAR.d
  2. +20 −49 arrowSection.d
  3. +14 −3 backupDancer.d
  4. +8 −2 levelScreen.d
  5. +1 −1 levels.txt
  6. BIN sounds/fail.mp3
  7. BIN sounds/win.mp3
  8. +6 −2 warningBar.d
View
4 AAR.d
@@ -60,7 +60,8 @@ void main(){
currentLevel = selectS._levels[selectS._selectedLevel];
levelS = new LevelScreen(currentLevel);
listenforkey = true;
Shitz shitzShitty = new Shitz(levelS, win);
Thread inputThread = new Thread(&shitzShitty.callMyShit);
inputThread.start();
@@ -75,6 +76,7 @@ void main(){
}
void drawLevelScreen() {
userquit = false;
clear();
sc = new SoundClip("music/" ~ currentLevel._audio);
View
@@ -64,61 +64,35 @@ class ArrowSection {
_frame.drawSprite();
// draw arrows and shit
bool first = false;
hit.drawSprite();
if(!fast){
// XXX: atomic swap on _input
ubyte diff, cacheInput;// = _input;
//_input = 0;
cacheInput = llvm_atomic_swap!(ubyte)(&_input, 0);
//cacheInput = _input;
//_input = 0;
/*
asm{
push EDX;
push ECX;
ubyte diff, cachedInput;
mov EDX, 0;
mov ECX, input;
lock;
xchg [ECX], EDX;
mov ECX, cacheInput;
mov [ECX], EDX;
pop ECX;
pop EDX;
}*/
cachedInput = llvm_atomic_swap!(ubyte)(&_input, 0);
if(offset > 1){
//beats[0] arrows - inputs
diff = beats[0].arrows & (~beats[0].inputs);
// diff & _input
diff &= cacheInput;
good += lut[diff];
// mark as not missed
beats[0].inputs |= diff;
if(beats[0].arrows == cachedInput){
good += lut[cachedInput];
beats[0].arrows = 0;
first = true;
}
}
if(offset < 3){
// _input - diff ==> inputs that counted above don't count twice
ubyte diff2 = cacheInput & (~diff);
if(offset < 3 && !first){
if(cachedInput == beats[1].arrows){
// diff2 & beats[1].arrows
diff2 &= beats[1].arrows;
if(offset == 0){
// beat[1] is on target at offset 0
great += lut[diff2];
}else{
good += lut[diff2];
}
beats[1].inputs |= diff2;
if(offset == 0){
great += lut[cachedInput];
}else{
good += lut[cachedInput];
}
beats[1].arrows = 0;
}
}
if(offset == 0){
@@ -143,9 +117,7 @@ class ArrowSection {
if(beats.length > beatsOnScreen){
// score Misses on dis
ubyte temp = beats[0].arrows & (~beats[0].inputs);
misses += lut[temp];
misses += lut[beats[0].arrows];
if(beats[0].end){noMoreBeats = true;}
@@ -208,6 +180,5 @@ private:
struct Beat{
bool end;
ubyte arrows; //lrud
ubyte inputs;
double period;
}
View
@@ -5,8 +5,8 @@ import tango.math.random.Random;
import animatedAsciiSprite;
class BackupDancer {
enum Animate { DOWN, JUMP, LEFT, MOONWALK, RIGHT, UP, YMCA }
AnimatedAsciiSprite[7] _animations;
enum Animate { DOWN, JUMP, LEFT, MOONWALK, RIGHT, UP, YMCA, THRUSTLEFT, THRUSTRIGHT, DISCO }
AnimatedAsciiSprite[10] _animations;
Animate _curAnimation;
this(int x, int y) {
@@ -17,6 +17,9 @@ class BackupDancer {
_animations[Animate.RIGHT] = new AnimatedAsciiSprite("graphics/man-right.txt", null, true, true, x, y);
_animations[Animate.UP] = new AnimatedAsciiSprite("graphics/man-up.txt", null, true, true, x, y);
_animations[Animate.YMCA] = new AnimatedAsciiSprite("graphics/man-ymca.txt", null, true, true, x, y);
_animations[Animate.THRUSTLEFT] = new AnimatedAsciiSprite("graphics/man-thrust-left.txt", null, true, true, x, y);
_animations[Animate.THRUSTRIGHT] = new AnimatedAsciiSprite("graphics/man-thrust-right.txt", null, true, true, x, y);
_animations[Animate.DISCO] = new AnimatedAsciiSprite("graphics/man-disco.txt", null, true, true, x, y);
}
void setCurAnimation(Animate animation) {
@@ -25,7 +28,7 @@ class BackupDancer {
void animate() {
if(_animations[_curAnimation]._frame == _animations[_curAnimation]._animation.length - 1){
int random = rand.uniformR(7);
int random = rand.uniformR(10);
switch(random) {
case 0: _curAnimation = Animate.DOWN;
@@ -38,6 +41,14 @@ class BackupDancer {
break;
case 4: _curAnimation = Animate.UP;
break;
case 5: _curAnimation = Animate.THRUSTLEFT;
break;
case 6: _curAnimation = Animate.THRUSTRIGHT;
break;
case 7: _curAnimation = Animate.DISCO;
break;
case 8: _curAnimation = Animate.LEFT;
break;
default: _curAnimation = Animate.YMCA;
}
}
View
@@ -12,6 +12,7 @@ import asciiSprite;
import narwhal;
import backupDancer;
import warningBar;
import util.soundclip;
class LevelScreen {
DataScore _score;
@@ -39,9 +40,9 @@ class LevelScreen {
void draw(bool fast) {
_score.setScore((-50*_arrowSect.misses) + (100*_arrowSect.good) + (200*_arrowSect.great));
_warningBar.updateWarningBar(_arrowSect.misses, (_arrowSect.good + _arrowSect.great));
_warningBar.updateWarningBar(_arrowSect.misses, _arrowSect.great);
if(_warningBar._level >= 32){
if(_warningBar._level >= 32 && _arrowSect.misses > 5){
endGame(false);
}
@@ -62,13 +63,18 @@ class LevelScreen {
}
void endGame(bool win) {
SoundClip sc;
_playing = false;
AsciiSprite winText = new AsciiSprite("graphics/victory.txt", null, false, 62, 15);
AsciiSprite loseText = new AsciiSprite("graphics/failure.txt", null, false, 62, 15);
if(win){
sc = new SoundClip("sounds/win.mp3");
sc.start();
winText.drawSprite();
} else {
sc = new SoundClip("sounds/fail.mp3");
sc.start();
loseText.drawSprite();
}
View
@@ -13,7 +13,7 @@ video_challenge-random.txt
Anamanaguchi_-_06_-_FloraFauna.mp3
FloraFauna
3
flora_fauna-random.txt
floral_fauna-random.txt
Anamanaguchi_-_07_-_Power_Supply.mp3
Power Supply
7
View
BIN +64.5 KB sounds/fail.mp3
Binary file not shown.
View
BIN +58.4 KB sounds/win.mp3
Binary file not shown.
View
@@ -11,8 +11,12 @@ class WarningBar {
_level = 0;
}
void updateWarningBar(int misses, int successes){
_level += misses - successes;
void updateWarningBar(int misses, int great){
if(great == 0){
great = 1;
}
_level = cast(int)((cast(double)misses/(cast(double)great)) * 32.0);
if(_level > 32){
_level = 32;

0 comments on commit c5ccf77

Please sign in to comment.