#include #include #include #include #include "gr-sim.h" // Based on BASIC program posted by FozzTexx, originally written in 1987 //140 REM MS is max steps, CS is current step, X/Y/X1/Y1/X2/Y2 is rocket position //150 REM CL is Apple II hi-res color group const int ysize=160,xsize=280,margin=24; int color_group; int max_steps; double x_even_older,x_old=0,y_even_older,y_old=0,cs,peak; double xpos,ypos,x_velocity,y_velocity; double i,n; void routine_370(void) { hplot(xpos+x_old+n,ypos+y_old+n); // NE hplot(xpos+x_old-n,ypos+y_old-n); // SW hplot(xpos+x_old+n,ypos+y_old-n); // SE hplot(xpos+x_old-n,ypos+y_old+n); // NW hplot(xpos+x_old,ypos+y_old+(n*1.5)); // N hplot(xpos+x_old+(n*1.5),ypos+y_old); // E hplot(xpos+x_old,ypos+y_old-(n*1.5)); // S hplot(xpos+x_old-(n*1.5),ypos+y_old); // W } int main(int argc, char **argv) { int ch; grsim_init(); home(); hgr(); soft_switch(MIXCLR); // Full screen label_180: color_group=random()%2; // HGR color group (PG or BO) x_velocity=(random()%3)+1; // x velocity = 1..3 y_velocity=-((random()%5)+3); // y velocity = -3..-7 max_steps=(random()%25)+40; // 40..64 xpos=(random()%(xsize-margin*2))+margin; // margin .. xsize-margin ypos=ysize; // start at ground peak=ypos; // peak starts at ground? /* Aim towards center of screen */ if (xpos>xsize/2) x_velocity=-x_velocity; /* Draw rocket */ for(cs=1;cs<=max_steps;cs++) { y_even_older=y_old; y_old=ypos; x_even_older=x_old; x_old=xpos; /* Move rocket */ xpos=xpos+x_velocity; ypos=ypos+y_velocity; /* adjust Y velocity, slow it down */ y_velocity=y_velocity+0.125; /* if we went higher, adjust peak */ if (ypos=(xsize-margin)) { cs=max_steps; // too far right } if (ypos<=margin) { cs=max_steps; // too far up } // if falling downward if (y_velocity>0) { // if too close to ground, explode if (ypos>=ysize-margin) { cs=max_steps; } // if fallen a bit past peak, explode if (ypos>ysize-(ysize-peak)/2) { cs=max_steps; } } // if not done, draw rocket if (cs