File: main.c - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

0001: #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
0002: 
0003: #include <stdio.h>
0004: #include <allegro5/allegro.h>
0005: #include <allegro5/allegro_font.h>
0006: #include <allegro5/allegro_ttf.h>
0007: #include <allegro5/allegro_image.h>
0008: #include <allegro5/allegro_audio.h>
0009: #include <allegro5/allegro_acodec.h>
0010: #include <allegro5/allegro_primitives.h>
0011: #include <math.h>
0012: 
0013: #define _RGB al_map_rgb
0014: #define _RGBA al_map_rgba
0015: #define oslSwapBuffers al_flip_display
0016: #define oslWaitVSync al_wait_for_vsync
0017: #define oslDeleteSound al_destroy_sample
0018: #define oslDrawFillRect al_draw_filled_rectangle
0019: 
0020: #define STALLMAN Stupid_Toe_Cheese_Eater_Hippie
0021: #define GPL Shitty_Confusing_License
0022: #define BSD3CLAUSE Actual_License_Of_This_Program
0023: 
0024: #define ESPAC_HORIZ 64
0025: #define HAUT_FIELD 138
0026: #define GRAVIT -0.05
0027: 
0028: 
0029: 
0030: typedef struct {
0031:     int rx;
0032:     int ry;
0033: } RESOLUTION;
0034: 
0035: typedef struct {
0036:     ALLEGRO_SAMPLE *ref;
0037:     ALLEGRO_SAMPLE_INSTANCE *instance;
0038: } OSL_SOUND;
0039: 
0040: typedef struct {
0041:     ALLEGRO_AUDIO_STREAM *stream;
0042: } OSL_MOD;
0043: 
0044: typedef struct {
0045:     ALLEGRO_BITMAP *asset;
0046:     float sizeX;
0047:     float sizeY;
0048:     float x;
0049:     float y;
0050:     float stretchX;
0051:     float stretchY;
0052:     float centerX;
0053:     float centerY;
0054:     float angle;
0055: 
0056:     int R;
0057:     int G;
0058:     int B;
0059: 
0060:     int trans;
0061: } OSL_IMAGE;
0062: 
0063: struct ball {
0064:     float speed_h;
0065:     float speed_v;
0066:     float speed_z;
0067:     int angle;
0068:     int x2d;
0069:     int y2d;
0070:     int z3d;
0071:     short poisoned;
0072: };
0073: 
0074: struct pie_entity {
0075:     int pie_hp;
0076:     int pie_facemode; //mode sarko-JLM-autre?
0077:     int pie_direction;
0078:     int pie_x;
0079:     int pie_y;
0080: };
0081: 
0082: OSL_IMAGE court, benj;
0083: ALLEGRO_FONT *freesans = NULL;
0084: ALLEGRO_COLOR current_col;
0085: ALLEGRO_EVENT_QUEUE *event_queue;
0086: ALLEGRO_DISPLAY *display = NULL;
0087: ALLEGRO_SAMPLE_ID *id[16];
0088: ALLEGRO_KEYBOARD_STATE kbdstate;
0089: ALLEGRO_BITMAP *psp_screen = NULL;
0090: ALLEGRO_VOICE *voice;
0091: ALLEGRO_MIXER *mixer;
0092: ALLEGRO_TIMER *timer = NULL;
0093: ALLEGRO_EVENT_QUEUE *event_queue = NULL;
0094: short redraw = 1;
0095: 
0096: unsigned long int counter=0;
0097: unsigned int ratio=0;
0098: 
0099: const float FPS = 60;
0100: 
0101: OSL_IMAGE oslSetImageRotCenter(OSL_IMAGE osl_img)
0102: {
0103:     OSL_IMAGE dis = osl_img;
0104:     dis.centerX = dis.sizeX/2;
0105:     dis.centerY = dis.sizeY/2;
0106:     return dis;
0107: }
0108: 
0109: OSL_IMAGE oslSetImageTileSize(OSL_IMAGE img_param, int sx, int sy, int w, int h)
0110: {
0111:     OSL_IMAGE dis;
0112:     dis = img_param;
0113: 
0114:     dis.asset = al_create_sub_bitmap(dis.asset, sx, sy, w, h);
0115:     dis.sizeX = w;
0116:     dis.sizeY = h;
0117:     dis.stretchX = w;
0118:     dis.stretchY = h;
0119: 
0120:     return dis;
0121: }
0122: 
0123: OSL_IMAGE LoadImg(const char *filename)
0124: {
0125:     OSL_IMAGE dis;
0126: 
0127:     dis.asset = al_load_bitmap(filename);
0128:     dis.sizeX = al_get_bitmap_width(dis.asset);
0129:     dis.sizeY = al_get_bitmap_height(dis.asset);
0130:     dis.x = 0;
0131:     dis.y = 0;
0132:     dis.stretchX = dis.sizeX;
0133:     dis.stretchY = dis.sizeY;
0134:     dis.centerX = 0;
0135:     dis.centerY = 0;
0136:     dis.angle = 0;
0137: 
0138:     dis.R=255;
0139:     dis.G=255;
0140:     dis.B=255;
0141: 
0142:     dis.trans=255;
0143: 
0144:     return dis;
0145: }
0146: 
0147: OSL_IMAGE oslCreateImage(int w, int h)
0148: {
0149:     OSL_IMAGE dis;
0150: 
0151:     dis.asset = al_create_bitmap(w, h);
0152:     dis.sizeX = al_get_bitmap_width(dis.asset);
0153:     dis.sizeY = al_get_bitmap_height(dis.asset);
0154:     dis.x = 0;
0155:     dis.y = 0;
0156:     dis.stretchX = dis.sizeX;
0157:     dis.stretchY = dis.sizeY;
0158:     dis.centerX = 0;
0159:     dis.centerY = 0;
0160:     dis.angle = 0;
0161: 
0162:     dis.R=255;
0163:     dis.G=255;
0164:     dis.B=255;
0165: 
0166:     dis.trans=255;
0167: 
0168:     return dis;
0169: }
0170: 
0171: int random(int k)
0172: {
0173:     return rand()%k;
0174: }
0175: 
0176: int swirl_collide(int px, int py, int gudule, int mgsy)
0177: {
0178:     if ((px-(gudule))*(px-(gudule))+(py-(mgsy))*(py-(mgsy)) <= 512) return 1; else return 0;
0179: }
0180: 
0181: struct ball initball()
0182: {
0183:     struct ball abadgh;
0184: 
0185:      abadgh.x2d=random(320)+80; //x
0186:      abadgh.y2d=170;     //y
0187:      abadgh.speed_v=-1;  //vy
0188:      abadgh.speed_h=0;   //vx
0189:      abadgh.speed_z=2;  //vz
0190:      abadgh.angle=0;    //
0191:      abadgh.z3d=2;      //z
0192:      abadgh.poisoned=0;
0193: 
0194:      return abadgh;
0195: }
0196: 
0197: struct pie_entity initpie()
0198: {
0199:     struct pie_entity abadgh;
0200:     abadgh.pie_facemode=0;
0201:     abadgh.pie_direction=0;
0202:     abadgh.pie_x=128;
0203:     abadgh.pie_y=136;
0204:     return abadgh;
0205: }
0206: 
0207: struct ball apply_impulse(struct ball ball_arg, float v, float v2, float angle)
0208: {
0209:     struct ball dis = ball_arg;
0210: 
0211:     dis.speed_h = v;
0212:     dis.speed_v = -v2;
0213: 
0214:     return dis;
0215: }
0216: 
0217: int getScreenRatio()
0218: {
0219:     ALLEGRO_MONITOR_INFO proutzob;
0220:     RESOLUTION res;
0221:     int a,b;
0222: 
0223:     al_get_monitor_info(0, &proutzob);
0224:     a=(proutzob).x2 - (proutzob).x1 + 1;
0225:     b=(proutzob).y2 - (proutzob).y1 + 1;
0226: 
0227:     res.rx = a;
0228:     res.ry = b;
0229: 
0230:     return (a*100)/b;
0231: }
0232: 
0233: OSL_IMAGE oslDeleteImage(OSL_IMAGE image)
0234: {
0235:     OSL_IMAGE dis = image;
0236:     al_destroy_bitmap(dis.asset);
0237:     return dis;
0238: }
0239: 
0240: void oslSetTextColor(ALLEGRO_COLOR col)
0241: {
0242:     current_col = col;
0243: }
0244: 
0245: void oslDrawString(float x, float y, const char *text)
0246: {
0247:     al_draw_text(freesans, current_col, x, y, 0, text);
0248: }
0249: 
0250: void spr_draw(OSL_IMAGE image, float x, float y)
0251: {
0252:     al_draw_tinted_scaled_rotated_bitmap(image.asset, al_map_rgba(image.R, image.G, image.B, image.trans), image.centerX, image.centerY, x, y, (image.stretchX)/(image.sizeX), (image.stretchY)/(image.sizeY), (image.angle)/60, 0);
0253:     image.x = x;
0254:     image.y = y;
0255: }
0256: 
0257: OSL_MOD oslLoadSoundFileMOD(const char *filename)
0258: {
0259:     OSL_MOD dis;
0260:     dis.stream = al_load_audio_stream(filename, 10, 1024);
0261:     al_attach_audio_stream_to_mixer(dis.stream, mixer);
0262:     return dis;
0263: }
0264: 
0265: void oslSetSoundLoopMOD(OSL_MOD sound, short yesno)
0266: {
0267:     if (yesno == 1) al_set_audio_stream_playmode(sound.stream,ALLEGRO_PLAYMODE_LOOP); else al_set_audio_stream_playmode(sound.stream, ALLEGRO_PLAYMODE_ONCE);
0268: }
0269: 
0270: void oslPlaySoundMOD(OSL_MOD sound)
0271: {
0272:     al_set_audio_stream_playmode(sound.stream, ALLEGRO_PLAYMODE_LOOP);
0273:     al_set_audio_stream_playing(sound.stream, true);
0274: }
0275: 
0276: void oslStopSoundMOD(OSL_MOD sound)
0277: {
0278:     al_set_audio_stream_playing(sound.stream, false);
0279: }
0280: 
0281: void oslDeleteSoundMOD(OSL_MOD sound)
0282: {
0283:     oslStopSoundMOD(sound);
0284:     al_destroy_audio_stream(sound.stream);
0285: }
0286: 
0287: OSL_SOUND oslLoadSoundFile(const char *filename)
0288: {
0289:     OSL_SOUND dis;
0290:     dis.ref = al_load_sample(filename);
0291:     dis.instance = al_create_sample_instance(dis.ref);
0292:     al_set_sample_instance_playmode(dis.instance, ALLEGRO_PLAYMODE_ONCE);
0293:     al_attach_sample_instance_to_mixer(dis.instance, mixer);
0294:     return dis;
0295: }
0296: 
0297: void oslSetSoundLoop(OSL_SOUND sound, short yesno)
0298: {
0299:     if (yesno == 1) al_set_sample_instance_playmode(sound.instance,ALLEGRO_PLAYMODE_LOOP); else al_set_sample_instance_playmode(sound.instance,ALLEGRO_PLAYMODE_ONCE);
0300: }
0301: 
0302: void oslPlaySound(OSL_SOUND sound)
0303: {
0304:     if (!al_play_sample_instance(sound.instance)) oslDrawString(0, 0, "could not play sound!");
0305: }
0306: 
0307: void oslStopSound(OSL_SOUND sound)
0308: {
0309:     al_stop_sample_instance(sound.instance);
0310: }
0311: 
0312: void oslDeleteSound(OSL_SOUND sound)
0313: {
0314:     oslStopSound(sound);
0315:     al_destroy_sample_instance(sound.instance);
0316: }
0317: 
0318: void oslStartDrawing()
0319: {
0320:     al_set_target_bitmap(psp_screen);
0321: }
0322: 
0323: void oslEndDrawing()
0324: {
0325:     al_set_target_bitmap(al_get_backbuffer(display));
0326:     al_draw_scaled_bitmap(psp_screen, 0, 0, 480, 272, 0, (al_get_display_height(display)-al_get_display_width(display)*9/16)/2, al_get_display_width(display), al_get_display_width(display)*9/16, 0);
0327: }
0328: 
0329: OSL_IMAGE oslSetAlpha(OSL_IMAGE gfx, int trans_p)
0330: {
0331:     OSL_IMAGE dis = gfx;
0332:     dis.trans = trans_p;
0333:     return dis;
0334: }
0335: 
0336: OSL_IMAGE oslSetTint(OSL_IMAGE img_param, int pR, int pG, int pB)
0337: {
0338:     OSL_IMAGE dis;
0339:     dis = img_param;
0340: 
0341:     dis.R = pR;
0342:     dis.G = pG;
0343:     dis.B = pB;
0344: 
0345:     return dis;
0346: }
0347: 
0348: int oslGetStringWidth(const char *text)
0349: {
0350:     int j;
0351:     j=al_get_text_width(freesans, text);
0352:     return j;
0353: }
0354: 
0355: void cls()
0356: {
0357:     al_set_target_bitmap(al_get_backbuffer(display));
0358:     oslDrawFillRect(0,0, al_get_display_width(display), al_get_display_height(display), _RGB(0, 0, 0));
0359:     oslSwapBuffers();
0360:     al_set_target_bitmap(psp_screen);
0361: }
0362: 
0363: void fadeout()
0364: {
0365:     int i;
0366:     al_set_target_bitmap(al_get_backbuffer(display));
0367:     for (i=0; i<80; i++)
0368:     {
0369:         oslDrawFillRect(0,0, al_get_display_width(display), al_get_display_height(display), _RGBA(0, 0, 0, i));
0370:         oslSwapBuffers();
0371:         oslWaitVSync();
0372:     }
0373:     al_set_target_bitmap(psp_screen);
0374: }
0375: 
0376: void draw_benj(OSL_IMAGE benj, int px, int py, short shielded, OSL_IMAGE shield)
0377: {
0378: 
0379:     float court_zoom = 0.00192*(py+32) + 0.562;
0380:     shield.stretchX = (int)(48*(float)court_zoom);
0381:     shield.stretchY = (int)(48*(float)court_zoom);
0382: 
0383:     if ((benj.angle) == -90)
0384:     {
0385:         spr_draw(benj, px-16, py+88);
0386:     }
0387:     else if ((benj.angle) == 90)
0388:     {
0389:         spr_draw(benj, px+64, py+32);
0390:     }
0391:     else if ((benj.angle) == 0) spr_draw(benj, px, py);
0392: 
0393:     if (shielded)
0394:     {
0395:         shield.trans=128;
0396:         spr_draw(shield, px+4, py+16);
0397:     }
0398: }
0399: 
0400: void amigatext(const char *arg, int x, int y, OSL_IMAGE amigafont, int width, int height)
0401: {
0402:     int i, l=strlen(arg), tx=x, placex=(amigafont.sizeX)/width;
0403:     OSL_IMAGE singlechar;
0404: 
0405: 
0406:     for(i=0; i<l; i++)
0407:     {
0408:         if (arg[i] <= 'Z')
0409:         {
0410:             singlechar=oslSetImageTileSize(amigafont, ((arg[i]-32)%placex)*width, ((arg[i]-32)/placex)*height, width, height);
0411:             spr_draw(singlechar, tx, y);
0412:         }
0413: 
0414:         tx += width;
0415:     }
0416: }
0417: 
0418: void credz()
0419: {
0420:     int frame=0, a=0, b=480, c=0, d=32, e=136, trans=0, skipframe=0, f=7, i, benj_frame=0;
0421:     short quit=0;
0422:     char buffer[39];
0423: 
0424:     const char *texts[23] = {"v2.00", "Released on 11/19/2014 for", "","", "(C) 2014 by",
0425:                             "Code, some GFX and .XM music by", "Ball physics and OSLib by",
0426:                             "Inspired by", "THE NONE", "Musics ingame ripped from", "EARTHBOUND",
0427:                             "PC Version powered by", "ALLEGRO V5", "Coding started on", "JULY 2013", "Hours of work", "COUNTLESS",
0428:                             "Most pictures were found on", "GOOGLE PICS", "Number of defeat animations", "25", " ", " "};
0429: 
0430:     const char *greeted[25] = {"ICEMAN", "PRINCEPS-BONUS", "ODIE_ONE", "MAGEDRAXGONVAMPIRE", "XELTEKSEN", "FEI", "SHYKOOPA77", "XIRIUS_THIR", "GOBOLZ",
0431:                              "MEZ", "ORION_", "ZEROSQUARE", "BRUNNI", "MATMOOK", "JEFFR3Y", "DR.DEIMOS", "GODZIL", "ARETHIUS", "TENDERNESS", "KEYDEE GAMER BOY",
0432:                              "OBO", "BARONLESTAT666", "ISOBEL", "LUNA240681", "...AND MANY OTHERS"};
0433: 
0434:     OSL_MOD theme;
0435:     OSL_IMAGE aipc;
0436:     OSL_IMAGE twt;
0437:     OSL_IMAGE gml;
0438:     OSL_IMAGE amiga;
0439:     OSL_IMAGE giygas;
0440:     OSL_IMAGE sonicexe;
0441:     OSL_IMAGE flappy_redhill;
0442:     OSL_IMAGE _1in24, aa, bb;
0443:     OSL_IMAGE temp_gfx, temp_benj;
0444:     OSL_IMAGE iamgod[4];
0445: 
0446:     theme = oslLoadSoundFileMOD("./muzaxx/credz.xm");
0447:     aipc = LoadImg("./gfx/credz/aipc.png");
0448:     twt = LoadImg("./gfx/credz/twitter.png");
0449:     gml = LoadImg("./gfx/credz/gmail.png");
0450:     amiga = LoadImg("./gfx/credz/amiga.png");
0451:     giygas = LoadImg("./gfx/credz/giygas.png");
0452:     sonicexe = LoadImg("./gfx/sonicexe.png");
0453:     flappy_redhill = LoadImg("./gfx/flappy_redhill.png");
0454:     aa = LoadImg("./gfx/pookey1.png");
0455:     bb = LoadImg("./gfx/pona08.png");
0456:     temp_gfx.asset = al_create_bitmap(480, 272);
0457: 
0458:     for (i=1; i<=4; i++)
0459:     {
0460:         sprintf(buffer,"./gfx/iamgod%d.png",i);
0461:         iamgod[i-1] = LoadImg(buffer);
0462:     }
0463: 
0464:     sprintf(buffer,"./gfx/pasta%d.png",random(42)+1);
0465:     _1in24 = LoadImg(buffer);
0466: 
0467:    
0468:     oslStartDrawing();
0469:     oslDrawFillRect(0, 0, 480, 272, _RGB(0,0,0));
0470:     oslEndDrawing();
0471:     oslSwapBuffers();
0472: 
0473:     giygas = oslSetImageRotCenter(giygas);
0474: 
0475:     oslPlaySoundMOD(theme);
0476: 
0477:     while ((frame < 10600) && (!quit))
0478:     {
0479:         if (!skipframe)
0480:         {
0481:             oslStartDrawing();
0482:             oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
0483:             if (frame < 684)
0484:             {
0485:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 64));
0486:                 for(a=0; a<16; a++)
0487:                 {
0488:                     oslDrawFillRect(a*32+c, 0, a*32+c+4, 272, _RGB(94, 126, 255));
0489:                     if (a<11) oslDrawFillRect(0, a*32+c, 480, a*32+c+4, _RGB(94, 126, 255));
0490:                 }
0491: 
0492:                 temp_benj = oslSetImageTileSize(benj, (benj_frame%8)*32, 48, 32,48);
0493:                 temp_benj.stretchX = 96;
0494:                 temp_benj.stretchY = 144;
0495:                 if (frame < 492) benj.trans=192; else benj.trans=684-frame;
0496:                 spr_draw(temp_benj, 78, 90);
0497:                 if (frame < 428) benj.trans=255; else benj.trans=684-frame;
0498: 
0499:                 oslSetImageTileSize(aipc, 0, 0, (frame<76)?frame*4:304, 34);
0500:                 spr_draw(aipc, 10, 10);
0501:                 if (c > -32) c--; else c=0;
0502: 
0503:                 if (frame > 180)
0504:                 {
0505:                     /*if (frame < 428)
0506:                     {
0507:                         if (d > 255) oslSetAlpha(OSL_FX_DEFAULT, 0); else oslSetAlpha(OSL_FX_ALPHA, d);
0508:                     }
0509:                     else
0510:                     {
0511:                         oslSetAlpha(OSL_FX_ALPHA, 684-frame);
0512:                     }*/
0513:                     oslSetTextColor(_RGB(255, 255, 255));
0514:                     for (a=0; a<5; a++) oslDrawString(b, 100+a*20, texts[a]);
0515:                     amigatext("A.C. 2014", b, 132, amiga, 16, 22);
0516:                     amigatext("240-185", b, 192, amiga, 16, 22);
0517:                     if (b > 264) b -= 4;
0518:                     if (d < 255) d += 2;
0519:                 }
0520: 
0521:             }
0522: 
0523:             if ((frame >= 684) && (frame < 1368))
0524:             {
0525:                 if ((frame==684) || (frame == 1032))
0526:                 {
0527:                     d=-12;
0528:                     trans=0;
0529:                 }
0530: 
0531:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 64));
0532:                 for(a=0; a<16; a++)
0533:                 {
0534:                     oslDrawFillRect(a*32+c, 0, a*32+c+4, 272, _RGB(94, 126, 255));
0535:                     if (a<11) oslDrawFillRect(0, a*32+c, 480, a*32+c+4, _RGB(94, 126, 255));
0536:                 }
0537:                 if (c > -32) c--; else c=0;
0538: 
0539:                 //oslSetAlpha(OSL_FX_ALPHA, trans);
0540: 
0541:                 if (trans < 252) trans+=4;
0542: 
0543:                 if (frame < 1032)
0544:                 {
0545:                     b=oslGetStringWidth(texts[5]);
0546:                     oslDrawString((480-b)/2, d, texts[5]);
0547:                     amigatext("240-185", 184, d+32, amiga, 16, 22);
0548:                 }
0549:                 else
0550:                 {
0551:                     b=oslGetStringWidth(texts[6]);
0552:                     oslDrawString((480-b)/2, d, texts[6]);
0553:                     amigatext("BRUNNI", 192, d+32, amiga, 16, 22);
0554:                 }
0555: 
0556:                 if (d < 66) d += 2;
0557:             }
0558: 
0559: 
0560:             if ((frame >= 1368) && (frame <= 2735))
0561:             {
0562:                 temp_gfx.stretchX = 480;
0563:                 temp_gfx.centerX = 0;
0564:                 temp_gfx.centerY = 0;
0565: 
0566:                 oslStartDrawing();
0567:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
0568: 
0569:                
0570: 
0571: 
0572:                 if (f < 21)
0573:                 {
0574:                     b=oslGetStringWidth(texts[f]);
0575:                     oslDrawString(240+(240-b)/2, 120, texts[f]);
0576: 
0577:                     b=strlen(texts[f+1])*16;
0578:                     amigatext(texts[f+1], 240+(240-b)/2, 144, amiga, 16, 22);
0579:                     spr_draw(giygas, 120, 136);
0580:                 }
0581: 
0582: 
0583:                 temp_gfx=oslSetImageRotCenter(temp_gfx);
0584:                 temp_gfx.stretchX = d;
0585:                 temp_gfx.stretchY = (int)((float)(0.57)*d);
0586: 
0587:                 if (frame == 1368)
0588:                 {
0589:                     d=0;
0590:                     e=136;
0591:                 }
0592: 
0593:                 spr_draw(temp_gfx, 240, e);
0594: 
0595:                 if (temp_gfx.stretchX > 1280) e += 8; else e=136;
0596:                 if (temp_gfx.stretchX < 1536) d += 8; else
0597:                 {
0598:                     f += 2;
0599:                     d=0;
0600:                 }
0601:                 oslEndDrawing();
0602:             }
0603: 
0604:             if ((frame >= 2736) && (frame < 3422))
0605:             {
0606:                 if (frame == 2736)
0607:                 {
0608:                     a=0;
0609:                     b=1;
0610:                     c=0;
0611:                 }
0612: 
0613:                 spr_draw(sonicexe, 204, 20+16*sin(0.0625*frame));
0614: 
0615:                 switch(c)
0616:                 {
0617:                 case 0:
0618:                     oslDrawString(198, 136, "SONIC.EXE by");
0619:                     amigatext("CRIMSON THE BAT", (480-strlen("CRIMSON THE BAT")*16)/2, 150, amiga, 16, 22);
0620:                     break;
0621: 
0622:                 case 1:
0623:                     amigatext("SYMBIOTICFEDORAGEEK", (480-strlen("SYMBIOTICFEDORAGEEK")*16)/2, 150, amiga, 16, 22);
0624:                     break;
0625: 
0626:                 case 2:
0627:                     amigatext("SHADOWNINJA976", (480-strlen("SHADOWNINJA976")*16)/2, 150, amiga, 16, 22);
0628:                     break;
0629: 
0630:                 case 3:
0631:                     amigatext("HICHIGO1989", (480-strlen("HICHIGO1989")*16)/2, 150, amiga, 16, 22);
0632:                     break;
0633: 
0634:                 default:
0635:                     break;
0636:                 }
0637: 
0638:                 if (c>0) oslDrawString((480-strlen("SONIC.EXE DeviantArts by:")*6)/2, 136, "SONIC.EXE DeviantArts by:");
0639: 
0640:                 for(i=0; i<32; i++)
0641:                 {
0642:                     spr_draw(flappy_redhill, a+i*16, 224);
0643:                 }
0644: 
0645:                 a--;
0646: 
0647:                 if (a == -16) a=0;
0648: 
0649:                 b++;
0650:                 if ((!(b%172)) && (c<3)) c++;
0651:             }
0652: 
0653:             if ((frame >= 3422) && (frame < 3764))
0654:             {
0655:                 _1in24=oslSetImageRotCenter(_1in24);
0656:                 _1in24.angle = 16*sin(0.0625*frame);
0657:                 spr_draw(_1in24, 240, 136);
0658: 
0659:                 oslDrawString(0, 0, "Weird movies stills taken from:");
0660:                 amigatext("STUART <ASHENS> ASHEN", 0, 30, amiga, 16, 22);
0661:                 amigatext("1IN24.TUMBLR.COM", 0, 60, amiga, 16, 22);
0662:             }
0663: 
0664:             if ((frame >= 3764) && (frame < 4105))
0665:             {
0666:                 if (frame == 3764)
0667:                 {
0668:                     aa=oslSetImageRotCenter(aa);
0669:                 }
0670: 
0671:                 aa.angle = 16*sin(0.0625*frame);
0672:                 spr_draw(aa, 240, 136);
0673: 
0674:                 oslDrawString(0, 0, "High-pitched Pookeymon Theme by");
0675:                 amigatext("DAN <LOUSY PANDAH> TOMLINSON", 0, 24, amiga, 16, 22);
0676:                 oslDrawString(0, 60, "Taken from animation 'POKEMON SHOWDOWN'");
0677:             }
0678: 
0679:             if ((frame >= 4105) && (frame < 4447))
0680:             {
0681:                 if (frame == 4105)
0682:                 {
0683:                     bb=oslSetImageRotCenter(bb);
0684:                 }
0685: 
0686:                 bb.angle = 16*sin(0.0625*frame);
0687:                 spr_draw(bb, 240, 136);
0688: 
0689:                 oslDrawString(0, 0, "Scene from 'Pikachu on Acid' taken from:");
0690:                 amigatext("HIGH5TOONS", 0, 24, amiga, 16, 22);
0691:             }
0692: 
0693:             if ((frame >= 4447) && (frame < 5473))
0694:             {
0695:                 if (frame == 4447)
0696:                 {
0697:                     c=0;
0698:                 }
0699: 
0700:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 64));
0701:                 for(a=0; a<16; a++)
0702:                 {
0703:                     oslDrawFillRect(a*32+c, 0, a*32+c+4, 272, _RGB(94, 126, 255));
0704:                     if (a<11) oslDrawFillRect(0, a*32+c, 480, a*32+c+4, _RGB(94, 126, 255));
0705:                 }
0706: 
0707:                 temp_benj=oslSetImageTileSize(benj, (benj_frame%8)*32, 48, 32, 48);
0708:                 temp_benj.stretchX = 96;
0709:                 temp_benj.stretchY = 144;
0710:                 temp_benj.trans=16;
0711:                 spr_draw(temp_benj, 192, 90);
0712: 
0713:                 if (c > -32) c--; else c=0;
0714: 
0715:                 if (frame <= 5090)
0716:                 {
0717:                 amigatext("SO, THERE WE ARE. I HAD TO", 0, 20, amiga, 16, 22);
0718:                 amigatext("TRAVEL FOR 700 KMS IN ORDER TO", 0, 42, amiga, 16, 22);
0719:                 amigatext("PRESENT MY SECOND HOMEBREW ON", 0, 64, amiga, 16, 22);
0720:                 amigatext("PSP.", 0, 86, amiga, 16, 22);
0721:                 amigatext("LITTLE DID I KNOW I HAD TO", 0, 130, amiga, 16, 22);
0722:                 amigatext("DEAL WITH A 2 PLAYER MODE ON A", 0, 152, amiga, 16, 22);
0723:                 amigatext("PORTABLE CONSOLE! LUCKILY, I", 0, 174, amiga, 16, 22);
0724:                 amigatext("WAS ADDICTED TO A MOBA GAME", 0, 196, amiga, 16, 22);
0725:                 amigatext("CALLED <SMITE>...", 0, 218, amiga, 16, 22);
0726:                 }
0727:                 else
0728:                 {
0729:                 amigatext("...AND THE IMPLEMENTATION OF", 0, 24, amiga, 16, 22);
0730:                 amigatext("A MOBA UI WAS A BREEZE. ", 0, 46, amiga, 16, 22);
0731:                 amigatext("THE MORAL OF THE STORY IS TO", 0, 90, amiga, 16, 22);
0732:                 amigatext("NEVER PREPARE YOUR PRODUCTION", 0, 112, amiga, 16, 22);
0733:                 amigatext("WAAAAAAAAAAY BEFORE THE CON", 0, 134, amiga, 16, 22);
0734:                 amigatext("BEGINS!", 0, 156, amiga, 16, 22);
0735:                 }
0736:             }
0737: 
0738:             if ((frame >= 5473) && (frame < 8894))
0739:             {
0740:                 if (frame == 5473)
0741:                 {
0742:                     d=480;
0743:                     i=0;
0744:                 }
0745: 
0746:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 64));
0747:                 for(a=0; a<16; a++)
0748:                 {
0749:                     oslDrawFillRect(a*32+c, 0, a*32+c+4, 272, _RGB(94, 126, 255));
0750:                     if (a<11) oslDrawFillRect(0, a*32+c, 480, a*32+c+4, _RGB(94, 126, 255));
0751:                 }
0752: 
0753:                 temp_benj = oslSetImageTileSize(benj, (benj_frame%8)*32, 48, 32, 48);
0754:                 temp_benj.stretchX = 96;
0755:                 temp_benj.stretchY = 144;
0756:                 temp_benj.trans=192;
0757:                 spr_draw(temp_benj, 192, 90);
0758: 
0759: 
0760:                 if (c > -32) c--; else c=0;
0761: 
0762:                 oslDrawString(201, 4, "Greetings to:");
0763:                 amigatext(greeted[i], d, 136+32*sin(0.0625*frame), amiga, 16, 22);
0764: 
0765:                 d=(int)(d-5.5);
0766: 
0767:                 if ((d <= -288) && (i<23))
0768:                 {
0769:                     d=480;
0770:                     i++;
0771:                 }
0772: 
0773:             }
0774: 
0775:             if (frame >= 8894)
0776:             {
0777:                 //if (frame < 10260) oslSetAlpha(OSL_FX_DEFAULT, 0); else oslSetAlpha(OSL_FX_ALPHA, trans);
0778:                 a = 54+32*sin(0.0625*frame);
0779:                 b = 296+32*cos(0.0625*frame);
0780: 
0781:                 spr_draw(gml, a, 32);
0782:                 spr_draw(twt, b, 32);
0783: 
0784:                 amigatext("@240185", 304+32*cos(0.0625*frame), 187, amiga, 16, 22);
0785:                 amigatext("ROUNDSOFTSTUDIO", 0, 172, amiga, 16, 22);
0786:                 amigatext("@ GMAIL.COM", 32+32*sin(0.0625*frame), 202, amiga, 16, 22);
0787: 
0788:                 if (frame >= 9582)
0789:                 {
0790:                     if (frame == 9582)
0791:                     {
0792:                         c=480;
0793:                         trans=255;
0794:                     }
0795:                     oslDrawString(c, 256, "See you @ A.C. 2015 for my next project for PSP: THE FIFTH AXIS! Discover a twisted theory about time travel!");
0796: 
0797:                     c -= 2;
0798:                 }
0799: 
0800:                 if ((frame >= 10260) && (trans > 0)) trans--;
0801:             }
0802: 
0803:             oslEndDrawing();
0804:             //frame_debug(frame);
0805:         }
0806:         oslSwapBuffers();
0807:         oslWaitVSync();
0808:         frame++;
0809:         if (!(frame%4)) benj_frame++;
0810:     }
0811: 
0812:     oslStopSoundMOD(theme);
0813: 
0814:     oslDeleteSoundMOD(theme);
0815:     oslDeleteImage(aipc);
0816:     oslDeleteImage(amiga);
0817:     oslDeleteImage(gml);
0818:     oslDeleteImage(twt);
0819:     oslDeleteImage(temp_gfx);
0820:     oslDeleteImage(giygas);
0821:     oslDeleteImage(sonicexe);
0822:     oslDeleteImage(flappy_redhill);
0823:     oslDeleteImage(_1in24);
0824:     oslDeleteImage(aa);
0825:     oslDeleteImage(bb);
0826: 
0827:     for (i=0; i<4; i++)
0828:     {
0829:         oslDeleteImage(iamgod[i]);
0830:     }
0831: 
0832:     fadeout();
0833: }
0834: 
0835: short sonicexe2(int diff)
0836: {
0837:     int i, rects=1, sc=0, bx=240, frame=0, bouss=0;
0838: 
0839:     short reussi=0;
0840:     OSL_IMAGE bg, pass, buttons, sexe2, slyexe;
0841:     OSL_IMAGE temp_benj;
0842:     OSL_SOUND oof = oslLoadSoundFile("./sfx/sfx-0009.wav");
0843:     OSL_SOUND passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
0844:     OSL_SOUND kte = oslLoadSoundFile("./sfx/kte.wav");
0845:     OSL_SOUND sallyexe = oslLoadSoundFile("./sfx/sallyexe.wav");
0846: 
0847:     sexe2 = LoadImg("./gfx/sonicexe2.png");
0848:     bg = LoadImg("./gfx/gfx-0776.png");
0849:     pass = LoadImg("./gfx/gfx-0718.png");
0850:     buttons = LoadImg("./gfx/arrows.png");
0851:     slyexe = LoadImg("./gfx/sallyexe.png");
0852: 
0853: 
0854: 
0855:     sexe2=oslSetImageRotCenter(sexe2);
0856:     buttons=oslSetImageRotCenter(buttons);
0857:     pass=oslSetImageRotCenter(pass);
0858: 
0859: 
0860: 
0861:     oslSetSoundLoop(kte, 1);
0862:     oslPlaySound(kte);
0863: 
0864:     while ((sc < 90*diff) && (rects < 240))
0865:     {
0866:         oslStartDrawing();
0867:         oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
0868:         bg.trans=160;
0869:         bg.G=0;
0870:         bg.B=0;
0871:         spr_draw(bg, 0, 0);
0872: 
0873:         al_get_keyboard_state(&kbdstate);
0874: 
0875:         if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (bx > rects))
0876:         {
0877:             temp_benj=oslSetImageTileSize(benj,(abs(frame%32)/4)*32,144,32,48);
0878:             temp_benj.stretchX = 64;
0879:             temp_benj.stretchY = 96;
0880:             bx -= 4;
0881:             if (bouss==0)
0882:             {
0883:                 bouss=1;
0884:                 sc++;
0885:             }
0886:         }
0887:         else if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (bx < (448-(rects+1))))
0888:         {
0889:             temp_benj=oslSetImageTileSize(benj,(abs(frame%32)/4)*32,48,32,48);
0890:             bx += 4;
0891:             if (bouss==1)
0892:             {
0893:                 bouss=0;
0894:                 sc++;
0895:             }
0896:         }
0897:         else
0898:         {
0899:             temp_benj=oslSetImageTileSize(benj,0,192,32,48);
0900:         }
0901: 
0902:         spr_draw(sexe2, 240+4*sin(0.0625*frame), 64);
0903:         spr_draw(buttons, 240, 136);
0904: 
0905:         temp_benj.stretchX = 64;
0906:         temp_benj.stretchY = 96;
0907:         temp_benj.R = temp_benj.G = temp_benj.B = 0;
0908:         spr_draw(temp_benj, bx, 176);
0909: 
0910:         oslDrawFillRect(0, 0, rects+1, 272, _RGB(0,0,0));
0911:         oslDrawFillRect(480, 0, 480-(rects+1), 272, _RGB(0,0,0));
0912:         oslDrawFillRect(0, 0, 480, rects+1, _RGB(0,0,0));
0913: 
0914:         oslEndDrawing();
0915:         oslSwapBuffers();
0916:         oslWaitVSync();
0917:         frame++;
0918:         if (!(frame%(20-((diff-1)*5)))) rects++;
0919:         if (bx < rects) bx=rects+4;
0920:         if (bx > (448-(rects+1))) bx=443-rects;
0921:     }
0922: 
0923: 
0924:     if (sc >= 90*diff)
0925:     {
0926:         for (i=0; i<4; i++)
0927:         {
0928:             oslStartDrawing();
0929:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
0930:             oslEndDrawing();
0931:             oslSwapBuffers();
0932:             oslWaitVSync();
0933:         }
0934:         oslPlaySound(passs);
0935:         for (i=135; i<=272; i+=24)
0936:         {
0937:             oslStartDrawing();
0938:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
0939:             spr_draw(pass,240,136);
0940:             pass.stretchX = pass.stretchY = i;
0941:             oslEndDrawing();
0942:             oslSwapBuffers();
0943:             oslWaitVSync();
0944:         }
0945:         reussi=1;
0946:     }
0947:     else
0948:     {
0949:         al_set_sample_instance_position(sallyexe.instance, 16);
0950:         oslPlaySound(sallyexe);
0951:         while (al_get_sample_instance_position(sallyexe.instance))
0952:         {
0953:             oslStartDrawing();
0954:             spr_draw(slyexe, 0, 0);
0955:             oslEndDrawing();
0956:             oslSwapBuffers();
0957:             oslWaitVSync();
0958:         }
0959:     }
0960: 
0961:    
0962:     oslStartDrawing();
0963:     oslEndDrawing();
0964:     oslSwapBuffers();
0965:     oslWaitVSync();
0966: 
0967: 
0968:     oslDeleteSound(kte);
0969:     oslDeleteImage(sexe2);
0970:     oslDeleteImage(bg);
0971:     oslDeleteImage(pass);
0972:     oslDeleteSound(oof);
0973:     oslDeleteSound(passs);
0974:     oslDeleteSound(sallyexe);
0975:     oslDeleteImage(slyexe);
0976:     return reussi;
0977: }
0978: 
0979: short sonicexe(int diff)
0980: {
0981:     short reussi=0, rebound=0;
0982:     int i, j=0, k=0, l=20, benj_frame=0, bgx=0, flx=0, bb, by, sedx=80, sedy=16;
0983:     OSL_IMAGE iamgod, sonicexebg, sonicexefloor, sonicexe_d, buttons, pass;
0984:     OSL_IMAGE temp_benj, temp_butt;
0985:     OSL_SOUND drowning;
0986:     OSL_SOUND oof;
0987:     OSL_SOUND passs;
0988: 
0989:     char buffer[20];
0990: 
0991:     i=random(4)+1;
0992:     bb=random(4);
0993:     sprintf(buffer,"./gfx/iamgod%d.png",i);
0994:     iamgod = LoadImg(buffer);
0995:     iamgod = oslSetImageRotCenter(iamgod);
0996:     sonicexebg = LoadImg("./gfx/gfx-0973.png");
0997:     sonicexefloor = LoadImg("./gfx/gfx-0974.png");
0998:     buttons = LoadImg("./gfx/buttons_pc.png");
0999:     sonicexe_d = LoadImg("./gfx/sonicexe.png");
1000:     pass = LoadImg("./gfx/gfx-0718.png");
1001:     pass = oslSetImageRotCenter(pass);
1002:     drowning = oslLoadSoundFile("./sfx/sfx-0146.wav");
1003:     oof = oslLoadSoundFile("./sfx/sfx-0009.wav");
1004:     passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
1005: 
1006:     al_set_sample_instance_position(drowning.instance, 2);
1007:     oslPlaySound(drowning);
1008: 
1009:     while ((al_get_sample_instance_position(drowning.instance)) && (j < 95*diff))
1010:     {
1011:         if (k > 96) l = 18;
1012:         if (k > 188) l = 16;
1013:         if (k > 262) l = 14;
1014:         if (k > 342) l = 12;
1015:         if (k > 390) l = 10;
1016:         if (k > 462) l = 8;
1017:         if (k > 516) l = 6;
1018:         if (k > 600) l = 4;
1019: 
1020:         if (k%l < (l/2)) by=0; else by=32;
1021: 
1022:         if (!(k%10))
1023:         {
1024:             sedx++;
1025:             sedy++;
1026:         }
1027: 
1028:         oslStartDrawing();
1029:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1030: 
1031:         spr_draw(sonicexebg, bgx, 8);
1032:         spr_draw(sonicexefloor, flx, 248);
1033:         spr_draw(sonicexebg, bgx+480, 8);
1034:         spr_draw(sonicexefloor, flx+480, 248);
1035:         spr_draw(sonicexe_d, sedx, sedy);
1036: 
1037:         temp_benj = oslSetImageTileSize(benj,(benj_frame%8)*32,48,32,48);
1038:         temp_butt = oslSetImageTileSize(buttons,bb*32,by,32,32);
1039:         temp_benj.stretchX = 64;
1040:         temp_benj.stretchY = 96;
1041:         temp_butt.stretchX = temp_butt.stretchY = 64;
1042: 
1043:         spr_draw(temp_benj, 360, 152);
1044:         spr_draw(temp_butt, 368, 82);
1045: 
1046:         /*sprintf(buffer,"%d %d", l, (int)oslGetRamStatus().maxAvailable);
1047:         oslDrawString(0,8,buffer);*/
1048:         oslEndDrawing();
1049:         oslSwapBuffers();
1050: 
1051:         al_get_keyboard_state(&kbdstate);
1052: 
1053:         if ((!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) &&
1054:             (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE)) &&
1055:             (!al_key_down(&kbdstate, ALLEGRO_KEY_C)) &&
1056:             (!al_key_down(&kbdstate, ALLEGRO_KEY_X))) rebound=0;
1057: 
1058:         if ((!rebound) && ((bb==0) && (al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL))) || ((bb==1) && (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) || ((bb==2) && (al_key_down(&kbdstate, ALLEGRO_KEY_C))) || ((bb==3) && (al_key_down(&kbdstate, ALLEGRO_KEY_X))))
1059:         {
1060:             j++;
1061:             rebound=1;
1062:         }
1063: 
1064:         if (!(k%4)) benj_frame++;
1065:         bgx -= 4;
1066:         flx -= 8;
1067:         if (bgx == -480) bgx=0;
1068:         if (flx == -480) flx=0;
1069:         k++;
1070: 
1071:         oslWaitVSync();
1072:     }
1073: 
1074:     if (j >= 95*diff)
1075:     {
1076:         for (i=0; i<4; i++)
1077:         {
1078:             oslStartDrawing();
1079:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1080:             oslEndDrawing();
1081:             oslSwapBuffers();
1082:             oslWaitVSync();
1083:         }
1084: 
1085:         oslPlaySound(passs);
1086:         for (i=135; i<=272; i+=24)
1087:         {
1088:             oslStartDrawing();
1089:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1090:             spr_draw(pass,240,136);
1091:             pass.stretchX = pass.stretchY = i;
1092:             oslEndDrawing();
1093:             oslSwapBuffers();
1094:             oslWaitVSync();
1095:         }
1096:         reussi=1;
1097:     }
1098:     else
1099:     {
1100: 
1101:         k=255;
1102:         for (i=sedx; i<360; i+=5)
1103:         {
1104:             oslStartDrawing();
1105:             bgx--;
1106:             flx -= 2;
1107:             spr_draw(sonicexebg, bgx, 8);
1108:             spr_draw(sonicexefloor, flx, 248);
1109:             spr_draw(sonicexebg, bgx+480, 8);
1110:             spr_draw(sonicexefloor, flx+480, 248);
1111:             spr_draw(temp_benj, 360, 152);
1112:             sonicexe_d.trans = k;
1113:             spr_draw(sonicexe_d, i, sedy);
1114:             oslEndDrawing();
1115:             oslSwapBuffers();
1116:             oslWaitVSync();
1117:             k -= 8;
1118:             if (k<0) k=0;
1119:             if (sedy < 168) sedy++;
1120:         }
1121: 
1122:         for (i=0; i<4; i++)
1123:         {
1124:             oslStartDrawing();
1125:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1126:             oslEndDrawing();
1127:             oslSwapBuffers();
1128:             oslWaitVSync();
1129:         }
1130: 
1131:         oslPlaySound(oof);
1132:         oslStartDrawing();
1133:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1134:         spr_draw(iamgod,240,136);
1135:         oslEndDrawing();
1136:         oslSwapBuffers();
1137:         fadeout();
1138:     }
1139: 
1140:     oslStartDrawing();
1141:     oslEndDrawing();
1142:     oslSwapBuffers();
1143:     oslWaitVSync();
1144: 
1145:     oslDeleteImage(iamgod);
1146:     oslDeleteImage(sonicexebg);
1147:     oslDeleteImage(sonicexefloor);
1148:     oslDeleteImage(sonicexe_d);
1149:     oslDeleteImage(buttons);
1150:     oslDeleteImage(pass);
1151:     oslDeleteSound(oof);
1152:     oslDeleteSound(drowning);
1153:     oslDeleteSound(passs);
1154: 
1155:     return reussi;
1156: }
1157: 
1158: short mincer(int diff)
1159: {
1160:     short reussi=0, floor=-1, score=0, rebound=0;
1161:     int i, skipframe=0, by=-36, bgy=0, my=404, minced=0, bb=random(4);
1162:     OSL_IMAGE mincer[3];
1163:     OSL_IMAGE benj_mincer;
1164:     OSL_IMAGE buttons;
1165:     OSL_IMAGE pass;
1166:     OSL_IMAGE temp_mincer, temp_butt, temp_m;
1167: 
1168:     OSL_SOUND passs;
1169:     OSL_SOUND mincing;
1170:     OSL_SOUND rightwrong[2];
1171: 
1172:     buttons = LoadImg("./gfx/buttons_pc.png");
1173:     pass = LoadImg("./gfx/gfx-0718.png");
1174:     mincer[0] = LoadImg("./gfx/mincer_bg.png");
1175:     mincer[1] = LoadImg("./gfx/mincer.png");
1176:     mincer[2] = LoadImg("./gfx/mincer_fg.png");
1177:     passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
1178:     mincing = oslLoadSoundFile("./sfx/sfx-0081.wav");
1179: 
1180:     rightwrong[0] = oslLoadSoundFile("./sfx/right.wav");
1181:     rightwrong[1] = oslLoadSoundFile("./sfx/wrong.wav");
1182: 
1183:     benj_mincer = LoadImg("./gfx/benj_mincer.png");
1184: 
1185:     pass=oslSetImageRotCenter(pass);
1186: 
1187:     temp_mincer=oslSetImageTileSize(benj_mincer,0,0,29,34);
1188:     temp_mincer.stretchX = temp_mincer.stretchY = 58;
1189: 
1190:     while ((floor <= (-2*diff+12)) && (score < (2*diff+3)))
1191:     {
1192:         if (!skipframe)
1193:         {
1194:             oslStartDrawing();
1195:             temp_butt=oslSetImageTileSize(buttons,bb*32,0,32,32);
1196:             temp_butt.stretchX = temp_butt.stretchY = 64;
1197: 
1198:             if (floor == -1)
1199:             {
1200:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,32));
1201:                 spr_draw(mincer[0], 80, 0);
1202:                 spr_draw(mincer[0], 80, 240);
1203:                 spr_draw(temp_mincer, 215, by);
1204:                 by += 4;
1205: 
1206:                 if (by==136) floor=0;
1207:             }
1208:             else if (floor >= 0)
1209:             {
1210:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,32));
1211:                 spr_draw(mincer[0], 80, bgy);
1212:                 spr_draw(mincer[0], 80, bgy+240);
1213: 
1214: 
1215:                 if (floor >= (-2*diff+9))
1216:                 {
1217:                     spr_draw(mincer[1], 182, my);
1218:                 }
1219: 
1220:                 spr_draw(mincer[0], 80, bgy+480);
1221: 
1222: 
1223:                 if (my < -108)
1224:                 {
1225:                     temp_mincer=oslSetImageTileSize(benj_mincer,29,0,29,34);
1226:                     temp_mincer.stretchX = temp_mincer.stretchY = 58;
1227:                 }
1228: 
1229:                 spr_draw(temp_mincer, 215, 136);
1230: 
1231:                 if (bgy<=-240)
1232:                     {
1233:                         floor++;
1234:                         bgy=0;
1235:                     }
1236: 
1237:                 if ((my <= 48) && (my >= -180))
1238:                 {
1239:                     if ((!minced) && (my==48))
1240:                         {
1241:                             if (!(al_get_sample_instance_position(mincing.instance))) oslPlaySound(mincing);
1242:                             score=0;
1243:                         }
1244: 
1245:                     switch(minced)
1246:                     {
1247:                         case 0:
1248:                         case 2:
1249:                         {
1250:                             bgy -= 2;
1251:                             if (floor >= (-2*diff+9))
1252:                                 {
1253:                                     temp_m=oslSetImageTileSize(mincer[0],0,0,101,240);
1254:                                     spr_draw(temp_m, 80, my-164);
1255:                                     temp_m=oslSetImageTileSize(mincer[0],226,0,94,240);
1256:                                     spr_draw(temp_m, 306, my-164);
1257:                                     spr_draw(mincer[2], 182, my+158);
1258:                                     temp_m=oslSetImageTileSize(mincer[0],0,0,320,240);
1259:                                     /*oslDrawFillRect(0,0,480,my-163, _RGB(0,0,32));
1260:                                    
1261:                                     spr_draw(temp_m, 80, my-164);*/
1262:                                     oslDrawFillRect(400,0,480,272, _RGB(0,0,32));
1263:                                     my -= 2;
1264:                                 }
1265: 
1266:                             if ((my == -96) && (!minced)) minced=1;
1267:                             break;
1268:                         }
1269: 
1270:                         case 1:
1271:                         {
1272:                             bgy += 2;
1273:                             if (floor >= (-2*diff+9))
1274:                                 {
1275:                                     temp_m=oslSetImageTileSize(mincer[0],0,0,101,240);
1276:                                     spr_draw(temp_m, 80, my-164);
1277:                                     oslSetImageTileSize(mincer[0],226,0,94,240);
1278:                                     spr_draw(temp_m, 306, my-164);
1279:                                     spr_draw(mincer[2], 182, my+158);
1280:                                     my += 2;
1281:                                     temp_m=oslSetImageTileSize(mincer[0],0,0,320,240);
1282:                                     oslDrawFillRect(400,0,480,272, _RGB(0,0,32));
1283:                                     /*oslDrawFillRect(0,0,480,my-163, _RGB(0,0,32));
1284: 
1285:                                     spr_draw(temp_m, 80, my-164);*/
1286:                                 }
1287:                             if (my == -12) minced=2;
1288:                             break;
1289:                         }
1290:                     }
1291: 
1292:                 }
1293:                 else
1294:                 {
1295:                     bgy -= 4;
1296:                     if (floor >= (-2*diff+9))
1297:                     {
1298:                         spr_draw(mincer[2], 182, my+158);
1299:                         my -= 4;
1300:                     }
1301: 
1302:                     al_get_keyboard_state(&kbdstate);
1303: 
1304:                     if ((!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) &&
1305:                         (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE)) &&
1306:                         (!al_key_down(&kbdstate, ALLEGRO_KEY_C)) &&
1307:                         (!al_key_down(&kbdstate, ALLEGRO_KEY_X))) rebound=0;
1308: 
1309:                     if (my > 48)
1310:                     {
1311:                         spr_draw(temp_butt, 326, 136);
1312: 
1313:                         if (!rebound)
1314:                         {
1315: 
1316: 
1317:                         if (((bb==0) && (al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL))) || ((bb==1) && (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) || ((bb==2) && (al_key_down(&kbdstate, ALLEGRO_KEY_C))) || ((bb==3) && (al_key_down(&kbdstate, ALLEGRO_KEY_X))))
1318:                             {
1319:                                 score++;
1320:                                 bb=random(4);
1321:                                 oslStopSound(rightwrong[0]);
1322:                                 oslStopSound(rightwrong[1]);
1323:                                 oslPlaySound(rightwrong[0]);
1324:                                 rebound=1;
1325:                             }
1326: 
1327: 
1328:                         else if (((bb!=0) && (al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL))) || ((bb!=1) && (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) || ((bb!=2) && (al_key_down(&kbdstate, ALLEGRO_KEY_C))) || ((bb!=3) && (al_key_down(&kbdstate, ALLEGRO_KEY_X))))
1329:                             {
1330:                                 bb=random(4);
1331:                                 oslStopSound(rightwrong[0]);
1332:                                 oslStopSound(rightwrong[1]);
1333:                                
1334:                                 oslPlaySound(rightwrong[1]);
1335:                                 score--;
1336:                                 rebound=1;
1337:                             }
1338:                         }
1339:                     }
1340:                 }
1341:             }
1342: 
1343:             oslEndDrawing();
1344:             oslSwapBuffers();
1345:             oslWaitVSync();
1346:         }
1347:     }
1348: 
1349:     if (score == (2*diff+3))
1350:     {
1351:         for (i=0; i<4; i++)
1352:         {
1353:             oslStartDrawing();
1354:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1355:             oslEndDrawing();
1356:             oslSwapBuffers();
1357:             oslWaitVSync();
1358:         }
1359:         oslPlaySound(passs);
1360:         for (i=135; i<=272; i+=24)
1361:         {
1362:             oslStartDrawing();
1363:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1364:             spr_draw(pass,240,136);
1365:             pass.stretchX = pass.stretchY = i;
1366:             oslEndDrawing();
1367:             oslSwapBuffers();
1368:             oslWaitVSync();
1369:         }
1370:         reussi=1;
1371:     }
1372: 
1373:     oslStartDrawing();
1374:     oslEndDrawing();
1375:     oslSwapBuffers();
1376:     oslWaitVSync();
1377: 
1378:     for (i=0; i<3; i++) oslDeleteImage(mincer[i]);
1379:     oslDeleteImage(benj_mincer);
1380:     oslDeleteSound(mincing);
1381:     oslDeleteSound(rightwrong[0]);
1382:     oslDeleteSound(rightwrong[1]);
1383:     oslDeleteImage(buttons);
1384:     oslDeleteImage(pass);
1385:     oslDeleteSound(passs);
1386: 
1387: 
1388: 
1389:     return reussi;
1390: }
1391: 
1392: short shoot_teevees(int diff, int *health, int round)
1393: {
1394:     short reussi=1, enemyx=random(2), enemyy=random(3), fired=13, hasdied=0, rebound=0;
1395:     int i, j, u, frame=0, skipframe=0, hgx=208;
1396: 
1397:     int teevees[3][4]; //angle-ecran-y-fallspeed
1398: 
1399:     OSL_SOUND passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
1400:     OSL_SOUND dead = oslLoadSoundFile("./sfx/sfx-0025.wav");
1401:     OSL_SOUND pew = oslLoadSoundFile("./sfx/sfx-0100.wav");
1402:     OSL_SOUND oof = oslLoadSoundFile("./sfx/sfx-0101.wav");
1403:     OSL_SOUND ambient = oslLoadSoundFile("./sfx/sfx-0017.wav");
1404:     OSL_IMAGE pass = LoadImg("./gfx/gfx-0718.png");
1405:     OSL_IMAGE bg = LoadImg("./gfx/gfx-0776.png");
1406:     OSL_IMAGE teevee = LoadImg("./gfx/teevee.png");
1407:     OSL_IMAGE teevee_targets = LoadImg("./gfx/teevee_targets.png");
1408:     OSL_IMAGE numberz = LoadImg("./gfx/numberz.png");
1409:     OSL_IMAGE handgun = LoadImg("./gfx/handgun.png");
1410:     OSL_IMAGE explode = LoadImg("./gfx/explode.png");
1411: 
1412:     OSL_IMAGE temp_h, temp, temp_tv, temp_no;
1413:    
1414:     temp = oslCreateImage(128, 96);
1415: 
1416:     pass=oslSetImageRotCenter(pass);
1417:     temp=oslSetImageRotCenter(temp);
1418:    
1419:     oslSetSoundLoop(ambient, 1);
1420: 
1421:     oslDrawFillRect(0,0, 480,272, _RGB(0,0,0));
1422: 
1423:     for (i=0; i<3; i++)
1424:     {
1425:             teevees[i][0]=random(180)-90;
1426:             teevees[i][1]=random(2);
1427:             teevees[i][2]=-1*random(128)-128;
1428:             teevees[i][3]=diff+1+random(3);
1429:     }
1430: 
1431:     temp_h=oslSetImageTileSize(handgun, 0, 0, 64, 64);
1432:     oslPlaySound(ambient);
1433: 
1434:     while (frame < 900*diff)
1435:     {
1436:         if (!skipframe)
1437:         {
1438:             oslStartDrawing();
1439:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1440: 
1441:             spr_draw(bg, 0, 0);
1442: 
1443:             oslSetTextColor(_RGB(255, 255, 255));
1444:             oslDrawString(160, 2, "Shoot the TVs with that screen:");
1445:             temp_tv=oslSetImageTileSize(teevee_targets, 99*enemyx, 71*enemyy, 99, 71);
1446:            
1447:             temp_tv.stretchX = 50;
1448:             temp_tv.stretchY = 35;
1449:             spr_draw(temp_tv, 215, 14);
1450: 
1451:             teevee_targets.stretchX = 99;
1452:             teevee_targets.stretchY = 71;
1453: 
1454: 
1455:             explode.stretchX = 128;
1456:             explode.stretchY = 96;
1457: 
1458: 
1459:             temp_no=oslSetImageTileSize(numberz,160,0,16,16);
1460:             spr_draw(temp_no, 2, 2);
1461: 
1462: 
1463:             for (i=0; i<3; i++)
1464:             {
1465:                     al_set_target_bitmap(temp.asset);
1466:                     temp_tv=oslSetImageTileSize(teevee_targets, teevees[i][1]*99, 71*enemyy, 99, 71);
1467:                     spr_draw(teevee, 0, 0);
1468:                     spr_draw(temp_tv, 14, 10);
1469: 
1470:                     al_set_target_bitmap(psp_screen);
1471:                     temp.angle = teevees[i][0];
1472: 
1473:                     spr_draw(temp, 160*i+80, teevees[i][2]);
1474:                     teevees[i][2] += teevees[i][3];
1475: 
1476:                     if (teevees[i][2] > (336+((int)128*(sin(teevee.stretchX)*3.14/180))))
1477:                     {
1478:                         if (teevees[i][1]==enemyx)
1479:                             {
1480:                                 *health -= 12*diff;
1481:                                 if ((*health <= 0) && (!hasdied))
1482:                                 {
1483:                                     oslPlaySound(dead);
1484:                                     hasdied=1;
1485:                                     frame=900*diff-131;
1486:                                 }
1487:                             }
1488:                         teevees[i][0]=random(180)-90;
1489:                         teevees[i][1]=random(2);
1490:                         teevees[i][2]=-1*random(128)-128;
1491:                         teevees[i][3]=diff+1+random(3);
1492:                     }
1493:             }
1494: 
1495:             if (*health > 0) spr_draw(temp_h, hgx, 211+((int)3*sin(0.0625*frame))); else spr_draw(temp_h, hgx, 211+((int)3*sin(frame)));
1496: 
1497:             al_get_keyboard_state(&kbdstate);
1498: 
1499:             if  ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (hgx > 8) && (*health > 0)) hgx-=8;
1500:             if  ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (hgx < 408) && (*health > 0)) hgx+=8;
1501: 
1502:             if (fired < 13)
1503:             {
1504:                 fired--;
1505: 
1506:                 if ((teevees[hgx/160][1]==enemyx)  && (teevees[hgx/160][2] > 140))
1507:                 {
1508:                     spr_draw(explode, 160*i+80, teevees[hgx/160][2]);
1509:                 }
1510: 
1511:                 if (fired > 9)
1512:                 {
1513:                     temp_h=oslSetImageTileSize(handgun, 64, 0, 64, 64);
1514:                     spr_draw(temp_h, hgx, 211+((int)3*sin(0.0625*frame)));
1515:                 }
1516:                 else
1517:                 {
1518:                     temp_h=oslSetImageTileSize(handgun, 0, 0, 64, 64);
1519: 
1520:                         if (fired==8)
1521:                         {
1522:                             if ((teevees[hgx/160][1]==enemyx)  && (teevees[hgx/160][2] > 140))
1523:                             {
1524:                                 teevees[hgx/160][0]=random(180)-90;
1525:                                 teevees[hgx/160][1]=random(2);
1526:                                 teevees[hgx/160][2]=-1*random(128)-128;
1527:                                 teevees[hgx/160][3]=diff+1+random(3);
1528:                                 *health += 2*(4-diff);
1529:                                 if (*health >= 100) *health=100;
1530:                             }
1531:                         }
1532:                 }
1533: 
1534:             }
1535: 
1536:             if (!fired)
1537:             {
1538:                 fired=13;
1539:                 temp_h=oslSetImageTileSize(handgun, 0, 0, 64, 64);
1540: 
1541:             }
1542: 
1543:             if ((!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) rebound=0;
1544: 
1545:             if (((al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) || (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) && (fired==13) && (*health > 0) && (!rebound))
1546:             {
1547:                 fired--;
1548:                 oslStopSound(pew);
1549:                 oslPlaySound(pew);
1550:                 rebound=1;
1551: 
1552:                 if ((teevees[hgx/160][1]!=enemyx) && (teevees[hgx/160][2] > 140))
1553:                 {
1554:                     *health -= 6*diff;
1555:                     oslPlaySound(oof);
1556:                 }
1557:             }
1558: 
1559:             i=random(15);
1560:             u=18;
1561: 
1562:             if (*health <= 0)
1563:             {
1564:                 *health=0;
1565:             }
1566: 
1567:             if (*health < 25) j=16; else j=0;
1568: 
1569:                 if (*health / 100)
1570:                 {
1571:                     temp_no=oslSetImageTileSize(numberz,((round==2)?((i<12)?16:random(144)):16),0,16,16);
1572:                     spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
1573:                     u += 16;
1574:                 }
1575: 
1576:                 if (*health > 9)
1577:                 {
1578:                     if (round==2)
1579:                         {
1580:                             if (i<12)
1581:                                 {
1582:                                     temp_no=oslSetImageTileSize(numberz,((*health%100)/10)*16,j,16,16);
1583:                                 }
1584:                             else
1585:                                 {
1586:                                     temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
1587:                                 }
1588:                         }
1589:                     else temp_no=oslSetImageTileSize(numberz,((*health%100)/10)*16,j,16,16);
1590:                 spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
1591:                 u += 16;
1592:                 }
1593: 
1594:                 if (round==2)
1595:                     {
1596:                         if (i<12)
1597:                             {
1598:                                 temp_no=oslSetImageTileSize(numberz,(*health%10)*16,j,16,16);
1599:                             }
1600:                         else
1601:                             {
1602:                                 temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
1603:                             }
1604:                     }
1605:                 else temp_no=oslSetImageTileSize(numberz,(*health%10)*16,j,16,16);
1606:                 spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
1607: 
1608:             frame++;
1609:             oslEndDrawing();
1610:             oslSwapBuffers();
1611:             oslWaitVSync();
1612:         }
1613:     }
1614: 
1615: 
1616:         if (*health > 0)
1617:         {
1618:             oslStopSound(ambient);
1619:             for (i=0; i<4; i++)
1620:             {
1621:                 oslStartDrawing();
1622:                 oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1623:                 oslEndDrawing();
1624:                 oslSwapBuffers();
1625:                 oslWaitVSync();
1626:             }
1627:             oslPlaySound(passs);
1628:             for (i=135; i<=272; i+=24)
1629:             {
1630:                 oslStartDrawing();
1631:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1632:                 spr_draw(pass,240,136);
1633:                 pass.stretchX = pass.stretchY = i;
1634:                 oslEndDrawing();
1635:                 oslSwapBuffers();
1636:                 oslWaitVSync();
1637:             }
1638:         }
1639:         else reussi=0;
1640: 
1641:         oslStartDrawing();
1642:         oslEndDrawing();
1643:         oslSwapBuffers();
1644:         oslWaitVSync();
1645: 
1646:         oslDeleteImage(bg);
1647:         oslDeleteImage(pass);
1648:         oslDeleteImage(teevee);
1649:         oslDeleteImage(teevee_targets);
1650:         oslDeleteImage(handgun);
1651:         oslDeleteImage(temp);
1652:         oslDeleteImage(numberz);
1653:         oslDeleteImage(explode);
1654:         oslDeleteSound(passs);
1655:         oslDeleteSound(dead);
1656:         oslDeleteSound(pew);
1657:         oslDeleteSound(ambient);
1658:         oslDeleteSound(oof);
1659: 
1660:     return reussi;
1661: }
1662: 
1663: short flappy_cacodemon(int diff)
1664: {
1665:     short reussi=1, bunk=0, bgx=0, ghgx=0, dead=0, cacoy=32, pressed=26, mess=0, rebound=0;
1666:     int i, frame=0, skipframe=0, growl=random(360)+35, postree=0, gu;
1667: 
1668:     int walls[7]={0,0,0,0,0,0,random(100)};
1669: 
1670:     OSL_IMAGE pass = LoadImg("./gfx/gfx-0718.png");
1671:     OSL_IMAGE cacod = LoadImg("./gfx/cacodemon.png");
1672:     OSL_IMAGE pot = LoadImg("./gfx/pot.png");
1673:     OSL_IMAGE pot_edge = LoadImg("./gfx/pot_edge.png");
1674:     OSL_IMAGE flappy_bg = LoadImg("./gfx/flappy_bg.png");
1675:     OSL_IMAGE flappy_redhill = LoadImg("./gfx/flappy_redhill.png");
1676:     OSL_SOUND passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
1677:     OSL_SOUND ambient = oslLoadSoundFile("./sfx/sfx-0017.wav");
1678:     OSL_SOUND caco_sfx[2];
1679:     OSL_IMAGE temp_cacod;
1680: 
1681:     caco_sfx[0]= oslLoadSoundFile("./sfx/cacogrowl.wav");
1682:     caco_sfx[1]= oslLoadSoundFile("./sfx/cacodie.wav");
1683: 
1684:     temp_cacod=oslSetImageTileSize(cacod, 0, 0, 64, 64);
1685:     temp_cacod=oslSetImageRotCenter(temp_cacod);
1686:     temp_cacod.y=32;
1687:     pass=oslSetImageRotCenter(pass);
1688:    
1689:     oslSetSoundLoop(ambient, 1);
1690:     oslPlaySound(ambient);
1691: 
1692:     oslSetTextColor(_RGB(0,0,0));
1693: 
1694:     while ((frame < 300*diff+300) && (dead < 5))
1695:     {
1696:         if (!(frame%growl))
1697:         {
1698:             growl=random(360)+35;
1699:             oslPlaySound(caco_sfx[0]);
1700:         }
1701:         if (!skipframe)
1702:         {
1703:             oslStartDrawing();
1704:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1705: 
1706:                 for (i=0; i<5; i++) spr_draw(flappy_bg, bgx+i*138, 128);
1707: 
1708:             if (!bunk)
1709:             {
1710:                 for (i=6; i>=0; i--)
1711:                 {
1712:                     if (walls[i])
1713:                     {
1714:                         pot.stretchY = walls[i];
1715:                         spr_draw(pot, i*80-(postree%80), 230-walls[i]);
1716:                         spr_draw(pot_edge, i*80-(postree%80), 230-walls[i]);
1717: 
1718:                         pot.stretchY = 94-walls[i];
1719:                         spr_draw(pot, i*80-(postree%80), 0);
1720:                         spr_draw(pot_edge, i*80-(postree%80), 94-walls[i]);
1721: 
1722:                     }
1723:                 }
1724: 
1725:             }
1726: 
1727:             if ((!bunk) && (!dead))
1728:             {
1729:                 if ((postree%80) == (80-((diff==1)?1:((diff==2)?2:4))))
1730:                 {
1731:                     for (i=0; i<7; i++)
1732:                     {
1733:                         if (i < 6)
1734:                         {
1735:                             if (walls[i+1]) walls[i]=walls[i+1];
1736:                         }
1737:                         else
1738:                         {
1739:                             walls[6]=walls[5]+(random(2)?1:-1)*random(32);
1740:                             if (walls[6] < 32) walls[6]=32;
1741:                             if (walls[6] > 110) walls[6]=110;
1742:                         }
1743:                     }
1744:                 }
1745:             }
1746: 
1747:             for(i=0; i<32; i++)
1748:             {
1749:                 spr_draw(flappy_redhill, ghgx+i*16, 224);
1750:             }
1751: 
1752:             if (!bunk)
1753:             {
1754:                 if (!(frame%2))
1755:                 {
1756:                     temp_cacod.angle = 8*sin(0.15*frame);
1757:                 }
1758:                 spr_draw(temp_cacod, 40, temp_cacod.y);
1759:             }
1760:             else
1761:             {
1762:                 if ((!(frame%9))) dead++;
1763:                 gu=temp_cacod.y;
1764:                 temp_cacod=oslSetImageTileSize(temp_cacod, 64*dead, 0, 64, 64);
1765:                 temp_cacod=oslSetImageRotCenter(temp_cacod);
1766:                 temp_cacod.y=gu;
1767:                 spr_draw(temp_cacod, 40, temp_cacod.y);
1768:                 if (dead==1)
1769:                 {
1770:                     oslPlaySound(caco_sfx[1]);
1771:                 }
1772:             }
1773: 
1774:             if (!mess) oslDrawString(200, 18, "MAKE HIM FLY!");
1775: 
1776:             al_get_keyboard_state(&kbdstate);
1777: 
1778:             if ((!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) rebound=0;
1779: 
1780:             if (((al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) || (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) && (!rebound) && (!dead))
1781:             {
1782:                 pressed=0;
1783:                 if (!mess) mess=1;
1784:                 rebound=1;
1785:             }
1786: 
1787:                 pressed++;
1788:                 if ((temp_cacod.y > 35) && (pressed < (-4*diff+28))) temp_cacod.y -= diff;
1789:                 if ((!dead) && (pressed > (-4*diff+28))) temp_cacod.y += diff;
1790: 
1791: 
1792:             if (!bunk)
1793:             {
1794:                 if (!(frame%2)) bgx -= diff+1;
1795:                 ghgx -= (diff+1);
1796: 
1797:                 if (bgx <= -138) bgx=0;
1798:                 if (ghgx <= -16) ghgx=0;
1799: 
1800:             }
1801: 
1802:             if ((temp_cacod.y > 192) && (!bunk))
1803:             {
1804:                 bunk=1;
1805:                 frame=0;
1806:             }
1807: 
1808:             if ((walls[1]) && ((temp_cacod.y)-24 <= 102-walls[1]) && (!bunk) && (postree%80 < 40))
1809:             {
1810:                 bunk=1;
1811:                 frame=0;
1812:             }
1813: 
1814:             if ((walls[1]) && ((temp_cacod.y)+24 >= 230-walls[1]) && (!bunk) && (postree%80 < 40))
1815:             {
1816:                 bunk=1;
1817:                 frame=0;
1818:             }
1819: 
1820:             oslEndDrawing();
1821:             oslSwapBuffers();
1822:             oslWaitVSync();
1823:         }
1824:         frame++;
1825: 
1826:         if (!bunk)
1827:         {
1828:             postree += ((diff==1)?1:((diff==2)?2:4));
1829:         }
1830: 
1831:     }
1832: 
1833:     while (al_get_sample_instance_position(caco_sfx[1].instance))
1834:     {
1835:         al_rest(0.016);
1836:         oslWaitVSync();
1837:     };
1838: 
1839:     if (!bunk)
1840:     {
1841:         oslStopSound(ambient);
1842:             for (i=0; i<4; i++)
1843:             {
1844:                 oslStartDrawing();
1845:                 oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1846:                 oslEndDrawing();
1847:                 oslSwapBuffers();
1848:                 oslWaitVSync();
1849:             }
1850:         oslPlaySound(passs);
1851:         for (i=135; i<=272; i+=24)
1852:         {
1853:             oslStartDrawing();
1854:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
1855:             spr_draw(pass,240,136);
1856:             pass.stretchX = pass.stretchY = i;
1857:             oslEndDrawing();
1858:             oslSwapBuffers();
1859:             oslWaitVSync();
1860:         }
1861:     }
1862:     else reussi=0;
1863: 
1864:     oslStartDrawing();
1865:     oslEndDrawing();
1866:     oslSwapBuffers();
1867:     oslWaitVSync();
1868: 
1869:     oslDeleteImage(cacod);
1870:     oslDeleteImage(flappy_bg);
1871:     oslDeleteImage(flappy_redhill);
1872:     oslDeleteImage(pot);
1873:     oslDeleteImage(pot_edge);
1874:     oslDeleteSound(ambient);
1875:     oslDeleteImage(pass);
1876:     oslDeleteSound(passs);
1877:     oslDeleteSound(caco_sfx[0]);
1878:     oslDeleteSound(caco_sfx[1]);
1879:     return reussi;
1880: }
1881: 
1882: short love_boat(int diff)
1883: {
1884:     short reussi=1, alive=1, bx=240, boat_x=random(320)+80, sens;
1885:     int i, frame, a=0;
1886: 
1887:     OSL_IMAGE boat = LoadImg("./gfx/boat.png");
1888:     OSL_IMAGE boat_blood = LoadImg("./gfx/boat_blood.png");
1889:     OSL_SOUND boat_sfx = oslLoadSoundFile("./sfx/boat.wav");
1890:     OSL_SOUND sflartch = oslLoadSoundFile("./sfx/beng-0037.wav");
1891:     OSL_IMAGE pass = LoadImg("./gfx/gfx-0718.png");
1892:     OSL_IMAGE temp_benj;
1893:     OSL_SOUND passs = oslLoadSoundFile("./sfx/sfx-0053.wav");
1894:     OSL_SOUND ambient = oslLoadSoundFile("./sfx/sfx-0061.wav");
1895:     pass=oslSetImageRotCenter(pass);
1896:     boat=oslSetImageRotCenter(boat);
1897:     boat_blood=oslSetImageRotCenter(boat_blood);
1898: 
1899:     oslSetSoundLoop(ambient, 1);
1900:     oslPlaySound(ambient);
1901: 
1902:     frame = -1*random(540)-240;
1903: 
1904:     if (diff == 3)
1905:     {
1906:         if (boat_x%4)
1907:         {
1908:             boat_x += 4-(boat_x%4);
1909:         }
1910:     }
1911: 
1912:     while (frame < 255)
1913:     {
1914:         if (!frame) oslPlaySound(boat_sfx);
1915: 
1916:         oslStartDrawing();
1917:         oslDrawFillRect(0,0,480,272, _RGB(16,0,0));
1918: 
1919:         if (diff==3)
1920:         {
1921:             if (frame == 92)
1922:             {
1923:                 a = bx+32;
1924:             }
1925:             else if (frame > 92)
1926:             {
1927:                 if (boat_x > a) boat_x -= 4;
1928:                 if (boat_x < a) boat_x += 4;
1929:             }
1930:         }
1931:         else if (diff==2)
1932:         {
1933:             sens=random(2);
1934:             if ((sens) && (boat_x < (400-(boat.stretchX)/2))) boat_x += 4;
1935:             if ((!sens) && (boat_x > (boat.stretchX)/2)) boat_x -=4;
1936:         }
1937: 
1938:         if (frame >= 0)
1939:         {
1940:             boat.trans=frame;
1941:             boat.stretchX = frame*2;
1942:             boat.stretchY = (int)((float)1.5*(boat.stretchX));
1943:             spr_draw(boat, boat_x, 96);
1944:         }
1945: 
1946:         al_get_keyboard_state(&kbdstate);
1947: 
1948:         if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (bx > 0))
1949:         {
1950:             temp_benj = oslSetImageTileSize(benj,(abs(frame%32)/4)*32,144,32,48);
1951:             bx -= 4;
1952:         }
1953:         else if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (bx < 448))
1954:         {
1955:             temp_benj = oslSetImageTileSize(benj,(abs(frame%32)/4)*32,48,32,48);
1956:             bx += 4;
1957:         }
1958:         else
1959:         {
1960:             temp_benj = oslSetImageTileSize(benj,0,192,32,48);
1961:         }
1962: 
1963:         temp_benj.stretchX = 64;
1964:         temp_benj.stretchY = 96;
1965: 
1966:         if (alive) spr_draw(temp_benj, bx, 176);
1967: 
1968:         if (((boat.stretchX) >= 200))
1969:         {
1970:             if ((alive) && ((bx+32) >= (boat_x-((boat.stretchX)/4))) && ((bx+32) <= (boat_x+((boat.stretchX)/4))))
1971:             {
1972:                 alive=0;
1973:                 oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1974:                 oslPlaySound(sflartch);
1975:             }
1976:         }
1977: 
1978:         if (!alive)
1979:         {
1980:             spr_draw(boat_blood, 240, 136);
1981:         }
1982: 
1983:         oslEndDrawing();
1984:         oslSwapBuffers();
1985:         oslWaitVSync();
1986:         frame++;
1987:     }
1988: 
1989:     if (alive)
1990:     {
1991:         for (i=0; i<4; i++)
1992:         {
1993:             oslStartDrawing();
1994:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
1995:             oslEndDrawing();
1996:             oslSwapBuffers();
1997:             oslWaitVSync();
1998:         }
1999:         oslPlaySound(passs);
2000:         for (i=135; i<=272; i+=24)
2001:         {
2002:             oslStartDrawing();
2003:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2004:             spr_draw(pass,240,136);
2005:             pass.stretchX = pass.stretchY = i;
2006:             oslEndDrawing();
2007:             oslSwapBuffers();
2008:             oslWaitVSync();
2009:         }
2010:     }
2011:     else reussi=0;
2012: 
2013:     oslStartDrawing();
2014:     oslEndDrawing();
2015:     oslSwapBuffers();
2016:     oslWaitVSync();
2017: 
2018:     oslDeleteImage(boat);
2019:     oslDeleteImage(boat_blood);
2020:     oslDeleteSound(boat_sfx);
2021:     oslDeleteImage(pass);
2022:     oslDeleteSound(passs);
2023:     oslDeleteSound(sflartch);
2024:     oslDeleteSound(ambient);
2025:     return reussi;
2026: }
2027: 
2028: void draw_ball(struct ball ball_ent, OSL_IMAGE ball_gfx, OSL_IMAGE ball_shad)
2029: {
2030:     float yr = pow((ball_ent.y2d - 160) / HAUT_FIELD, 1.4f) * HAUT_FIELD + 160;
2031:     float x_pr_centre = ball_ent.x2d - 240;
2032:     float x_percent = x_pr_centre / 240;
2033:     float y_percent = (272-yr)/HAUT_FIELD;
2034:     float x_mult = 240 - ESPAC_HORIZ*y_percent;
2035:     float xr = x_percent * x_mult + 240;
2036: 
2037:     ball_gfx.stretchX = ball_gfx.stretchY = 8*(1-0.266f*y_percent);
2038:     ball_shad.stretchX = ball_shad.stretchY = 8*(1-0.266f*y_percent);
2039: 
2040:     spr_draw(ball_gfx, ball_ent.x2d, ball_ent.y2d-ball_ent.z3d);
2041:     spr_draw(ball_shad, ball_ent.x2d, ball_ent.y2d);
2042: }
2043: 
2044: int shoop_da_whoop(int health, int round, int diff)
2045: {
2046:     int i=480, f=0, ta=0, j, u, k=0, sc=0, a=0, b=0;
2047:     short sens=0, by=0;
2048: 
2049:     OSL_IMAGE starsky = LoadImg("./gfx/starsky.png");
2050:     OSL_SOUND firin = oslLoadSoundFile("./sfx/sdw.wav");
2051: 
2052:     OSL_SOUND sdwh = oslLoadSoundFile("./sfx/sdw2.wav");
2053:     OSL_SOUND expl_sound = oslLoadSoundFile("./sfx/sfx-0018.wav");
2054:     OSL_IMAGE buttons = LoadImg("./gfx/arrows.png");
2055:     OSL_IMAGE sdw = LoadImg("./gfx/sdw.png");
2056:     OSL_IMAGE sdw_sh = LoadImg("./gfx/sdw_sh.png");
2057:     OSL_IMAGE planet = LoadImg("./gfx/planet.png");
2058: 
2059:     OSL_IMAGE numberz = LoadImg("./gfx/numberz.png");
2060:     OSL_IMAGE explode = LoadImg("./gfx/explode.png");
2061: 
2062:     OSL_IMAGE temp = oslCreateImage(480, 272);
2063:     OSL_IMAGE shoot = oslCreateImage(160, 60);
2064: 
2065:     OSL_IMAGE temp_no;
2066: 
2067:     temp=oslSetImageRotCenter(temp);
2068:     sdw=oslSetImageRotCenter(sdw);
2069:     sdw_sh=oslSetImageRotCenter(sdw_sh);
2070:     planet=oslSetImageRotCenter(planet);
2071:     buttons=oslSetImageRotCenter(buttons);
2072: 
2073:     oslPlaySound(firin);
2074:     starsky=oslSetImageRotCenter(starsky);
2075: 
2076:     oslStartDrawing();
2077:     oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2078:     spr_draw(starsky, 240, 136);
2079:     oslEndDrawing();
2080:     oslSwapBuffers();
2081: 
2082:     for (i=480; i>=128; i-=4)
2083:     {
2084:         planet.stretchX = planet.stretchY = i;
2085:         oslStartDrawing();
2086:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2087:         spr_draw(starsky, 240, 136);
2088:         spr_draw(planet, 240, 136);
2089:         oslEndDrawing();
2090:         oslSwapBuffers();
2091:         oslWaitVSync();
2092:     }
2093: 
2094:     for (i=480; i>=360; i-=4)
2095:     {
2096:         oslStartDrawing();
2097:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2098:         spr_draw(starsky, 240, 136);
2099:         spr_draw(planet, 240, 136);
2100:         spr_draw(sdw, i, 136);
2101:         oslEndDrawing();
2102:         oslSwapBuffers();
2103:         oslWaitVSync();
2104:     }
2105: 
2106: 
2107: 
2108:     for (k=0; k<(diff+1); k++)
2109:     {
2110:         f=0;
2111: 
2112:         sc=0;
2113: 
2114:         if (k)
2115:         {
2116:             al_destroy_bitmap(shoot.asset);
2117:             shoot.asset = al_create_bitmap(160, 60);
2118: 
2119:             al_destroy_bitmap(temp.asset);
2120:             temp.asset = al_create_bitmap(480, 272);
2121:         }
2122: 
2123:         while ((f < 270) && (health > 0))
2124:         {
2125:             if ((f%30) >= 15) by=32; else by=0;
2126: 
2127:             oslStartDrawing();
2128:             spr_draw(sdw_sh, 240, 136);
2129: 
2130:             if (f < 120)
2131:             {
2132:                 if (!(f%20)) sens=random(2);
2133: 
2134:                 al_set_target_bitmap(temp.asset);
2135: 
2136:                 spr_draw(sdw, 360, 136);
2137: 
2138:                 ta += (sens)?6:-6;
2139: 
2140:                 if (ta < 0) ta += 360;
2141:                 if (ta > 359) ta = ta%360;
2142: 
2143:                 temp.angle = ta;
2144: 
2145:                 al_get_keyboard_state(&kbdstate);
2146: 
2147: 
2148:                 if (al_key_down(&kbdstate, ALLEGRO_KEY_LEFT))
2149:                 {
2150:                     sdw_sh.angle -= 12;
2151:                 }
2152: 
2153:                 if (al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT))
2154:                 {
2155:                     sdw_sh.angle += 12;
2156:                 }
2157: 
2158:                 if ((sdw_sh.angle) < 0)
2159:                 {
2160:                     (sdw_sh.angle) += 360;
2161:                 }
2162: 
2163:                 if ((sdw_sh.angle) > 359)
2164:                 {
2165:                     sdw_sh.angle = (float)((int)((sdw_sh.angle))%360);
2166:                 }
2167: 
2168: 
2169:                 /*if (((bb==0) && (osl_keys . pressed.circle)) || ((bb==1) && (osl_keys . pressed.cross)) || ((bb==2) && (osl_keys . pressed.square)) || ((bb==3) && (osl_keys . pressed.triangle)))
2170:                 {
2171:                     sc++;
2172:                 }*/
2173:             }
2174: 
2175:             if (((sdw_sh.angle - 60) < (temp.angle)) && ((sdw_sh.angle + 60) > (temp.angle)) && (f==119)) sc = 2*diff+2;
2176: 
2177:             if (((sdw_sh.angle - 60) < ((temp.angle)+360)) && ((sdw_sh.angle + 60) > ((temp.angle)+360)) && (f==119)) sc = 2*diff+2;
2178: 
2179: 
2180:                     if ((f >= 120) && (f <= 150))
2181:                     {
2182:                         temp.angle = 0;
2183:                         shoot.angle = 0;
2184: 
2185:                         al_set_target_bitmap(shoot.asset);
2186:                         oslDrawFillRect(160, 0, (-16/3)*f+800, 60, _RGB(0,0,255));
2187:                         oslDrawFillRect(160, 10, (-16/3)*f+800, 50, _RGB(0,128,255));
2188:                         oslDrawFillRect(160, 20, (-16/3)*f+800, 40, _RGB(0,255,255));
2189:                         oslDrawFillRect(160, 23, (-16/3)*f+800, 37, _RGB(128,255,255));
2190:                         oslDrawFillRect(160, 26, (-16/3)*f+800, 33, _RGB(255,255,255));
2191: 
2192:                         al_set_target_bitmap(temp.asset);
2193:                         spr_draw(shoot, 208, 116);
2194: 
2195:                         temp.angle = ta;
2196:                     }
2197: 
2198:                 if (sc == 2*diff+2)
2199:                 {
2200:                     if (f >= 150)
2201:                     {
2202:                     al_set_target_bitmap(temp.asset);
2203:                     spr_draw(sdw, 360, 136);
2204:                     if (f == 150) oslPlaySound(sdwh);
2205: 
2206:                         if (!(f%15))
2207:                         {
2208:                             oslStopSound(expl_sound);
2209:                             oslPlaySound(expl_sound);
2210:                             a=330+random(35);
2211:                             b=72+random(64);
2212:                         }
2213: 
2214:                         if ((f%10) < 5)
2215:                         {
2216:                             explode.stretchX = 64;
2217:                             explode.stretchY = 96;
2218:                             spr_draw(explode, a, b);
2219:                         }
2220:                         else
2221:                         {
2222:                             explode.stretchX = 32;
2223:                             explode.stretchY = 48;
2224:                             spr_draw(explode, a+16, b+24);
2225:                         }
2226:                     }
2227:                     if (f > 180) f=333;
2228:                 }
2229: 
2230:             al_set_target_bitmap(psp_screen);
2231:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2232:             spr_draw(starsky, 240, 136);
2233:             spr_draw(temp, 240, 136);
2234:             spr_draw(planet, ((f > 150) && (sc < 2*diff+1))?(238+random(5)):240, ((f > 150) && (sc < 2*diff+1))?(134+random(5)):136);
2235:             spr_draw(buttons, 240, 136);
2236:             spr_draw(sdw_sh, 240, 136);
2237: 
2238:             //if (f < 120) spr_draw(buttons, 208, 118);
2239:             if ((f >= 180) && (f <= 240) && (sc < 2*diff+1))
2240:             {
2241:                 if (f > 180)
2242:                 {
2243:                     if (!(f%3)) health--;
2244:                 }
2245: 
2246:                 if (!(f%15))
2247:                 {
2248:                     oslPlaySound(expl_sound);
2249:                     a=180+random(128);
2250:                     b=68+random(128);
2251:                 }
2252: 
2253:                 if ((f%10) < 5)
2254:                 {
2255:                     explode.stretchX = 64;
2256:                     explode.stretchY = 96;
2257:                     spr_draw(explode, a, b);
2258:                 }
2259:                 else
2260:                 {
2261:                     explode.stretchX = 32;
2262:                     explode.stretchY = 48;
2263:                     spr_draw(explode, a+16, b+24);
2264:                 }
2265: 
2266:             }
2267: 
2268:             i=random(15);
2269:             u=18;
2270: 
2271:             if (health <= 0)
2272:             {
2273:                 health=0;
2274:             }
2275: 
2276:             temp_no=oslSetImageTileSize(numberz,160,0,16,16);
2277:             spr_draw(temp_no, 2, 2);
2278: 
2279:             if (health < 25) j=16; else j=0;
2280: 
2281:                 if (health / 100)
2282:                 {
2283:                     temp_no=oslSetImageTileSize(numberz,((round==2)?((i<12)?16:random(144)):16),0,16,16);
2284:                     spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
2285:                     u += 16;
2286:                 }
2287: 
2288:                 if (health > 9)
2289:                 {
2290:                     if (round==2)
2291:                         {
2292:                             if (i<12)
2293:                                 {
2294:                                     temp_no=oslSetImageTileSize(numberz,((health%100)/10)*16,j,16,16);
2295:                                 }
2296:                             else
2297:                                 {
2298:                                     temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
2299:                                 }
2300:                         }
2301:                     else temp_no=oslSetImageTileSize(numberz,((health%100)/10)*16,j,16,16);
2302:                 spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
2303:                 u += 16;
2304:                 }
2305: 
2306:                 if (round==2)
2307:                     {
2308:                         if (i<12)
2309:                             {
2310:                                 temp_no=oslSetImageTileSize(numberz,(health%10)*16,j,16,16);
2311:                             }
2312:                         else
2313:                             {
2314:                                 temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
2315:                             }
2316:                     }
2317:                 else temp_no=oslSetImageTileSize(numberz,(health%10)*16,j,16,16);
2318:                 spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
2319: 
2320: 
2321:             oslEndDrawing();
2322:             oslSwapBuffers();
2323:             oslWaitVSync();
2324:             f++;
2325:         }
2326:     }
2327: 
2328:     oslStartDrawing();
2329:     oslEndDrawing();
2330:     oslSwapBuffers();
2331:     oslWaitVSync();
2332: 
2333:     oslDeleteSound(firin);
2334:     oslDeleteSound(sdwh);
2335:     oslDeleteSound(expl_sound);
2336:     oslDeleteImage(buttons);
2337:     oslDeleteImage(sdw);
2338:     oslDeleteImage(planet);
2339:     oslDeleteImage(starsky);
2340:     oslDeleteImage(temp);
2341:     oslDeleteImage(shoot);
2342:     oslDeleteImage(explode);
2343:     oslDeleteImage(sdw_sh);
2344:     return health;
2345: }
2346: 
2347: void sad()
2348: {
2349:     int f=0;
2350:     OSL_IMAGE gr = LoadImg("./gfx/happyface.png");
2351:     OSL_SOUND ss = oslLoadSoundFile("./sfx/sfx-0027.wav");
2352:     OSL_SOUND dummy = oslLoadSoundFile("./sfx/dummy.wav");
2353: 
2354:     gr=oslSetImageRotCenter(gr);
2355:     oslSetSoundLoop(ss, 1);
2356: 
2357:     for (f=0; f<8; f++) oslPlaySound(dummy);
2358:     oslPlaySound(ss);
2359: 
2360:     f=0;
2361: 
2362:     while(f < 120)
2363:     {
2364:         oslStartDrawing();
2365:         oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
2366:         gr.stretchX = random(150)+400;
2367:         gr.stretchY =(int)((float) 0.75*(gr.stretchX));
2368:         spr_draw(gr, 240, 136);
2369:         oslEndDrawing();
2370:         oslSwapBuffers();
2371:         oslWaitVSync();
2372:         f++;
2373:     }
2374: 
2375:     oslStartDrawing();
2376:     oslEndDrawing();
2377:     oslSwapBuffers();
2378:     oslWaitVSync();
2379: 
2380:     oslDeleteImage(gr);
2381:     oslDeleteSound(ss);
2382:     oslDeleteSound(dummy);
2383: }
2384: 
2385: int game(int round, int diff, int nbp)
2386: {
2387:     int i, j, a=0, stun=0, u, global_fr=0, fs=0, quit=0, px=239, py=180, giyg_flag=0, mort=0, health, pbouss=0, benj_frame=0, tvnoise_ev=0, att_ch_timer=80, skipframe=0, gbg=0;
2388:     int cursor2p=0, mgcd=0, ko_frame=0, mgsy=0, ultlvl=0, ultrectshine=4, frappe=-1, frappe_ult=-1, shldlvl=60, racket_devnull=0, stary=0, suppo=0, suppox, suppoy, whineface=0, kx=0, ky=0;
2389: 
2390:     short lightsoff=0, paused=0, bulbfell=0, bulbfs=0, shielded=0, darkness=0, chair=0, attf=0, putin=0, ulted=0, rckchscr=0, nbult=0, returned=0, rebound=0;
2391:     short swinging=0, ulting=0;
2392: 
2393:     int giyg_bg_angles[3] = {0, 0, 0};
2394:     float court_zoom=1, reddv=0;
2395:     char buffer[20];
2396: 
2397:     int pie_attacks[8][5]; //numeroattaque-duree(frames)-x-y?
2398:     int att_cooldowns[15];
2399:     int stars_ult[5];
2400: 
2401:     int meteors[3][3];
2402: 
2403:     struct pie_entity pie_ent = initpie();
2404:     struct ball ball_ent = initball();
2405: 
2406:     ALLEGRO_EVENT ev;
2407: 
2408:     OSL_IMAGE pie, tvnoise[20], numberz, ulting_gfx;
2409:     OSL_SOUND minigametime = oslLoadSoundFile("./sfx/sfx-0080.wav");
2410:     OSL_SOUND tvnoisesound;
2411:     OSL_SOUND giygas[3];
2412:     OSL_SOUND quitter = oslLoadSoundFile("./sfx/quitter.wav");
2413:     OSL_SOUND ko_sfx = oslLoadSoundFile("./sfx/sfx-0045.wav");
2414:     OSL_SOUND expl_sound = oslLoadSoundFile("./sfx/sfx-0018.wav");
2415:     OSL_SOUND pew = oslLoadSoundFile("./sfx/sfx-0100.wav");
2416:     OSL_SOUND paf = oslLoadSoundFile("./sfx/beng-0011.wav");
2417:     OSL_SOUND meteor_fall = oslLoadSoundFile("./sfx/sfx-0040.wav");
2418:     OSL_SOUND expl_sound2 = oslLoadSoundFile("./sfx/sfx-0036.wav");
2419:     OSL_SOUND bulbsfx[7];
2420:     OSL_SOUND stun_sound =  oslLoadSoundFile("./sfx/sfx-0038.wav");
2421:     OSL_SOUND elec =  oslLoadSoundFile("./sfx/elec.wav");
2422:     OSL_SOUND thunder =  oslLoadSoundFile("./sfx/thunder.wav");
2423:     OSL_SOUND psis_sfx = oslLoadSoundFile("./sfx/sfx-0043.wav");
2424:     OSL_SOUND dictators_sfx[4];
2425: 
2426:     OSL_SOUND mouth_sfx[2];
2427:    
2428:     OSL_SOUND whine = oslLoadSoundFile("./sfx/sfx-0097.wav");
2429:     OSL_SOUND bounce = oslLoadSoundFile("./sfx/racketbounce.wav");
2430: 
2431: 
2432:     OSL_IMAGE lightning =  LoadImg("./gfx/lightning.png");
2433:     OSL_IMAGE premess =  LoadImg("./gfx/premess.png");
2434:     OSL_IMAGE giyg_bg[33], starsky = LoadImg("./gfx/starsky.png");
2435:     OSL_IMAGE sleepwell = LoadImg("./gfx/sleepwell.png");
2436:     OSL_IMAGE ball_gfx = LoadImg("./gfx/ball.png");
2437:     OSL_IMAGE ball_shad = LoadImg("./gfx/ball_shadow.png");
2438:     OSL_IMAGE ko = LoadImg("./gfx/ko.png");
2439:     OSL_IMAGE mgswirl = LoadImg("./gfx/mgswirl.png");
2440:     OSL_IMAGE explode = LoadImg("./gfx/explode.png");
2441:     OSL_IMAGE rckch[2];
2442:     OSL_IMAGE psycho = LoadImg("./gfx/gfx-0672.png");
2443:     OSL_IMAGE paused_gfx = LoadImg("./gfx/paused.png");
2444:     OSL_IMAGE ultgauge = LoadImg("./gfx/ultgauge.png");
2445:     OSL_IMAGE shlgauge = LoadImg("./gfx/shlgauge.png");
2446:     OSL_IMAGE visor = LoadImg("./gfx/visor.png");
2447:     OSL_IMAGE bulbasaur = LoadImg("./gfx/bulbasaur.png");
2448:     OSL_IMAGE recipe = LoadImg("./gfx/darkness.png");
2449:     OSL_IMAGE shield = LoadImg("./gfx/shield.png");
2450:     OSL_IMAGE meteor = LoadImg("./gfx/gfx-0471.png");
2451:     OSL_IMAGE stunning = LoadImg("./gfx/creepycircle.png");
2452:     OSL_IMAGE psis = LoadImg("./gfx/psis.png");
2453:     OSL_IMAGE dictators = LoadImg("./gfx/dictators.png");
2454:     OSL_IMAGE mouth = LoadImg("./gfx/gfx-0102.png");
2455:     OSL_IMAGE powerball = LoadImg("./gfx/powerball.png");
2456:     OSL_IMAGE star = LoadImg("./gfx/star.png");
2457:     OSL_IMAGE juche = LoadImg("./gfx/juche.png");
2458:     OSL_IMAGE suppo_gfx = LoadImg("./gfx/suppo.png");
2459:     OSL_IMAGE attch = LoadImg("./gfx/attchoice.png");
2460:     OSL_IMAGE cp2 = LoadImg("./gfx/cursor2p.png");
2461: 
2462:     OSL_SOUND benj_sfx[11];
2463: 
2464: 
2465:     OSL_IMAGE shadow, temp_ulting, temp_ultg, temp_psis, temp_recipe, temp_bulb, temp_prem, temp_benj, temp_pb, temp_dics, temp_lghtn, temp_suppo, temp_met, temp_no, temp_ko;
2466: 
2467:     numberz = LoadImg("./gfx/numberz.png");
2468: 
2469:     ulting_gfx = LoadImg("./gfx/ulting.png");
2470: 
2471:     benj_sfx[0] = oslLoadSoundFile("./sfx/beng-0000.wav");
2472:     benj_sfx[1] = oslLoadSoundFile("./sfx/beng-0001.wav");
2473:     benj_sfx[2] = oslLoadSoundFile("./sfx/beng-0002.wav");
2474:     benj_sfx[3] = oslLoadSoundFile("./sfx/beng-0003.wav");
2475:     benj_sfx[4] = oslLoadSoundFile("./sfx/beng-0004.wav"); //hurt
2476:     benj_sfx[5] = oslLoadSoundFile("./sfx/beng-0013.wav");
2477:     benj_sfx[6] = oslLoadSoundFile("./sfx/beng-0016.wav");
2478:     benj_sfx[7] = oslLoadSoundFile("./sfx/beng-0020.wav"); //pass
2479:     benj_sfx[8] = oslLoadSoundFile("./sfx/beng-0009.wav");
2480:     benj_sfx[9] = oslLoadSoundFile("./sfx/beng-0015.wav"); //ult
2481:     benj_sfx[10] = oslLoadSoundFile("./sfx/beng-0006.wav"); //shield
2482: 
2483:     dictators_sfx[0] = oslLoadSoundFile("./sfx/putin.wav"),
2484:     dictators_sfx[1] = oslLoadSoundFile("./sfx/kjun.wav"),
2485:     dictators_sfx[2] = oslLoadSoundFile("./sfx/hitler.wav"),
2486:     dictators_sfx[3] = oslLoadSoundFile("./sfx/skeletor.wav"),
2487:    
2488:     mouth_sfx[0] =  oslLoadSoundFile("./sfx/sfx-0021.wav");
2489:     mouth_sfx[1] = oslLoadSoundFile("./sfx/sfx-0022.wav"),
2490:    
2491:     rckch[0] = LoadImg("./gfx/rocking_chair.png");
2492:     rckch[1] = LoadImg("./gfx/rocking_chair2.png");
2493: 
2494:     pie_ent.pie_hp=100*round*diff;
2495: 
2496:     pie=LoadImg("./gfx/pie.png");
2497:     pie=oslSetImageRotCenter(pie);
2498:     starsky=oslSetImageRotCenter(starsky);
2499:     sleepwell=oslSetImageRotCenter(sleepwell);
2500:     rckch[0].centerX = 32;
2501:     rckch[0].centerY = 47;
2502:     rckch[1]=oslSetImageRotCenter(rckch[1]);
2503:     recipe=oslSetImageRotCenter(recipe);
2504:     paused_gfx=oslSetImageRotCenter(paused_gfx);
2505:     visor=oslSetImageRotCenter(visor);
2506:     mouth=oslSetImageRotCenter(mouth);
2507:     stunning=oslSetImageRotCenter(stunning);
2508:     powerball=oslSetImageRotCenter(powerball);
2509:     star=oslSetImageRotCenter(star);
2510:     ball_gfx.centerX = 3;
2511:     ball_gfx.centerY = 7;
2512: 
2513:     al_register_event_source(event_queue, al_get_display_event_source(display));
2514:     al_register_event_source(event_queue, al_get_timer_event_source(timer));
2515:     al_start_timer(timer);
2516: 
2517:     temp_pb=oslSetImageTileSize(powerball, 0, 0, 32, 32);
2518:     tvnoisesound = oslLoadSoundFile("./sfx/dummy.wav");
2519: 
2520:     mouth.stretchX = 10;
2521:     mouth.stretchY = 16;
2522: 
2523: 
2524:     for (i=0; i<8; i++)
2525:     {
2526:         for (j=0; j<5; j++)
2527:         {
2528:             pie_attacks[i][j]=0;
2529:             stars_ult[j]=-32;
2530:         }
2531:     }
2532: 
2533: 
2534: 
2535:     for (i=0; i<7; i++)
2536:     {
2537:         sprintf(buffer,"./sfx/sfx-0%d.wav",i+114);
2538:         bulbsfx[i]=oslLoadSoundFile(buffer);
2539:     }
2540: 
2541:     for (i=0; i<15; i++)
2542:     {
2543:         att_cooldowns[i]=(random((8-(diff*2)))*100+random(3*diff)*100+800);
2544:         att_cooldowns[i] += (((i==0) || (i==3) || (i==4))?9*att_cooldowns[i]:0) + 2*random((int)(((i!=0)?1.5:3.5)*att_cooldowns[i]));
2545:         if ((i!=0) && (i!=3) && (i!=4)) att_cooldowns[i]=att_cooldowns[i]/(0.5*round+0.5);
2546:     }
2547: 
2548:     oslSetSoundLoop(psis_sfx, 1);
2549: 
2550:     if (round == 2)
2551:     {
2552:         giygas[0] = oslLoadSoundFile("./sfx/sfx-0006.wav");
2553:         giygas[1] = oslLoadSoundFile("./sfx/sfx-0007.wav");
2554:         giygas[2] = oslLoadSoundFile("./sfx/sfx-0008.wav");
2555: 
2556:         for (i=0; i<20; i++)
2557:         {
2558:             sprintf(buffer,"./gfx/gfx-0%d.png",i+642);
2559:             tvnoise[i]= LoadImg(buffer);
2560:             tvnoise[i].stretchX = 480;
2561:             tvnoise[i].stretchY = 272;
2562:         }
2563: 
2564:         oslDeleteSound(tvnoisesound);
2565: 
2566:         tvnoisesound = oslLoadSoundFile("./sfx/sfx-0028.wav");
2567:         //tvnoisesound . volumeLeft = tvnoisesound . volumeRight = 0x2000;
2568:         oslSetSoundLoop(tvnoisesound, 1);
2569: 
2570:         if (round==2)
2571:         {
2572:             for (i=0; i<33; i++)
2573:             {
2574:                 sprintf(buffer,"./gfx/gfx-0%d.png",i+103);
2575:                 giyg_bg[i]=LoadImg(buffer);
2576:                 giyg_bg[i]=oslSetImageRotCenter(giyg_bg[i]);
2577:                 giyg_bg[i].stretchX = giyg_bg[i].stretchY = 512;
2578:             }
2579:         }
2580:     }
2581:     else
2582:     {
2583:         giygas[0] = oslLoadSoundFile("./sfx/sfx-0155.wav");
2584:         giygas[1] = oslLoadSoundFile("./sfx/sfx-0153.wav");
2585:         giygas[2] = oslLoadSoundFile("./sfx/dummy.wav");
2586: 
2587:         for (i=0; i<5; i++)
2588:         {
2589:             tvnoise[i]=LoadImg("./gfx/dummy.png");
2590:         }
2591:     }
2592: 
2593: 
2594: 
2595: 
2596:     //oslSetTransparentColor(RGB(255,0,255));
2597: 
2598: 
2599:     for (i=0; i<3; i++)
2600:     {
2601:         oslSetSoundLoop(giygas[i], 1);
2602:     }
2603: 
2604:     oslPlaySound(giygas[0]);
2605:     health=100;
2606:    
2607:     while(!quit)
2608:     {
2609:         al_wait_for_event(event_queue, &ev);
2610: 
2611:          if(ev.type == ALLEGRO_EVENT_TIMER) skipframe=1; else skipframe=0;
2612: 
2613:          if ((skipframe) && al_event_queue_is_empty(event_queue))
2614:          {
2615:             oslStartDrawing();
2616:             skipframe=0;
2617:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
2618: 
2619:             if (pie_ent.pie_hp < 1)
2620:             {
2621:                 pie_ent.pie_y = 136+5*sin(0.5*global_fr);
2622:             }
2623: 
2624:             spr_draw(starsky,239,136);
2625: 
2626:             if ((whineface) && (health > 0) && (pie_ent.pie_hp > 0))
2627:             {
2628:                 //oslSetAlpha(OSL_FX_DEFAULT, 0);
2629:                 pie.R=255;
2630:                 pie.G=pie.B=(32-whineface)*8;
2631:                 spr_draw(pie, pie_ent.pie_x, pie_ent.pie_y);
2632:                 temp_dics=oslSetImageTileSize(dictators, 160, 80, 80, 80);
2633:                 temp_dics=oslSetImageRotCenter(temp_dics);
2634:                 temp_dics.trans=whineface*8;
2635:                 spr_draw(temp_dics, pie_ent.pie_x, pie_ent.pie_y-22);
2636:                 whineface--;
2637:                 pie.R=pie.G=pie.B=255;
2638:             }
2639:             else
2640:             {
2641:                 pie.R=pie.G=pie.B=255;
2642:                 spr_draw(pie,pie_ent.pie_x, pie_ent.pie_y);
2643:             }
2644: 
2645: 
2646: 
2647: 
2648:             //oslSetAlpha(OSL_FX_DEFAULT, 0);
2649: 
2650:             for (i=0; i<((2*diff)+2); i++)
2651:             {
2652:                 if ((pie_attacks[i][0]==12) && (health > 0))
2653:                 {
2654:                     temp_dics=oslSetImageTileSize(dictators, 80*(pie_ent.pie_facemode%2), 80*(pie_ent.pie_facemode/2),80 ,80);
2655:                     temp_dics=oslSetImageRotCenter(temp_dics);
2656: 
2657:                     if (pie_attacks[i][1] > (240*diff-255))
2658:                     {
2659:                         temp_dics.trans=240*diff - pie_attacks[i][1];
2660:                     }
2661:                     else
2662:                     {
2663:                         temp_dics.trans=255;
2664:                     }
2665: 
2666:                     if (pie_attacks[i][1] < 0)
2667:                     {
2668:                         temp_dics.trans=255+pie_attacks[i][1];
2669:                     }
2670: 
2671:                     if (!whineface) spr_draw(temp_dics, pie_ent.pie_x, pie_ent.pie_y-22);
2672: 
2673:                     if (!paused) pie_attacks[i][1]--;
2674: 
2675:                     if (pie_attacks[i][1] == -255)
2676:                     {
2677:                         pie_attacks[i][0]=0;
2678:                         pie_ent.pie_facemode=0;
2679:                         putin=0;
2680:                     }
2681: 
2682:                     temp_dics.trans=255;
2683: 
2684:                     if ((pie_ent.pie_facemode == 2) && (pie_attacks[i][1]==90))
2685:                     {
2686:                         for (i=0; i<15; i++)
2687:                         {
2688:                             if ((i!=0) && (i!=3) && (i!=4) && (i != 11) && (i!=6)) att_cooldowns[i]=random(250);
2689:                         }
2690:                     }
2691: 
2692:                     if (pie_ent.pie_facemode == 0)
2693:                     {
2694:                         if (pie_attacks[i][1] > -255) putin=1; else putin=0;
2695:                     }
2696:                     if (pie_ent.pie_facemode == 1)
2697:                     {
2698:                         spr_draw(juche, pie_attacks[i][2], 40+30*sin(0.0625*pie_attacks[i][2]));
2699:                         pie_attacks[i][2] -= 3;
2700:                     }
2701:                 }
2702:             }
2703: 
2704:             if (health <= 0)
2705:             {
2706:                 temp_dics=oslSetImageTileSize(dictators, 160, 0, 80, 80);
2707:                 temp_dics=oslSetImageRotCenter(temp_dics);
2708:                 temp_dics.trans=255;
2709:                 spr_draw(temp_dics, pie_ent.pie_x, pie_ent.pie_y-22);
2710:             }
2711:             else if (pie_ent.pie_hp < 1)
2712:             {
2713:                 temp_dics=oslSetImageTileSize(dictators, 160, 80, 80, 80);
2714:                 temp_dics=oslSetImageRotCenter(temp_dics);
2715:                 temp_dics.trans=255;
2716:                 spr_draw(temp_dics, pie_ent.pie_x, pie_ent.pie_y-22);
2717:             }
2718: 
2719:             spr_draw(court,0,0);
2720: 
2721: 
2722:             if (!paused)
2723:             {
2724:                 if (pie_ent.pie_hp > 0)
2725:                 {
2726:                     if (!(pie_ent.pie_direction))
2727:                     {
2728:                             pie_ent.pie_x++;
2729:                             pie.angle+=((round==2)?(giyg_flag+1):1)*4;
2730: 
2731:                         if (pie_ent.pie_x>=351) pie_ent.pie_direction=1;
2732: 
2733:                     }
2734:                     else
2735:                     {
2736:                             pie_ent.pie_x--;
2737:                             pie.angle-=((round==2)?(giyg_flag+1):1)*4;
2738: 
2739: 
2740:                         if (pie_ent.pie_x<=128) pie_ent.pie_direction=0;
2741:                     }
2742:                 }
2743: 
2744: 
2745:                 if (round==2) starsky.angle=starsky.angle-(giyg_flag+1)*((random(10))-1);
2746: 
2747:                 if (counter >= 240)
2748:                 {
2749: 
2750:                     if (diff != 3) a=diff; else a=2;
2751: 
2752:                     if (counter == 240) ball_ent=apply_impulse(ball_ent, -1*a, -1*a, 30*3.14/180);
2753: 
2754:                     if (ultlvl > 239) ultlvl=239;
2755: 
2756:                     if ((!mgcd) && (!lightsoff) && (!rckchscr) && (mouth.stretchX == 10))
2757:                     {
2758:                         ball_ent.x2d += ball_ent.speed_h;
2759:                         ball_ent.y2d += ball_ent.speed_v;
2760: 
2761:                         /*ball_ent.speed_z += GRAVITY;
2762:                         ball_ent.z3d += ball_ent.speed_z;
2763: 
2764:                         if (ball_ent.z3d < 0)
2765:                         {
2766:                             ball_ent.speed_z = -1*(ball_ent.speed_z);
2767:                             ball_ent.z3d=0;
2768:                         }*/
2769: 
2770:                         ball_ent.z3d = abs(16*sin(0.0625*global_fr));
2771:                     }
2772: 
2773:                     if (ball_ent.y2d < 138)
2774:                         {
2775:                                 ball_ent.speed_v = -1*(ball_ent.speed_v);
2776:                                 ball_ent.y2d = 140;
2777: 
2778:                                 returned=0;
2779: 
2780:                                 if ((ball_ent.x2d >= pie_ent.pie_x-128) && (ball_ent.x2d <= pie_ent.pie_x+128))
2781:                                 {
2782:                                     pie_ent.pie_hp -= (4-diff);
2783:                                     ultlvl += 5-diff;
2784:                                     oslPlaySound(whine);
2785:                                     whineface=31;
2786:                                 }
2787:                                 else
2788:                                 {
2789:                                     if ((!suppo) && ((health) || (pie_ent.pie_hp)))
2790:                                     {
2791:                                         suppo = 150;
2792:                                         suppox = px - 32;
2793:                                         suppoy = py + 48;
2794:                                     }
2795:                                 }
2796: 
2797: 
2798:                                 if (ball_ent.speed_v > 0)
2799:                                 {
2800:                                     a=random(100);
2801:                                     //if (a > 85) ball_ent.poisoned=1; else ball_ent.poisoned=0;
2802:                                 }
2803: 
2804:                         }
2805: 
2806:                     if (ball_ent.y2d > 288)
2807:                         {
2808:                                 ball_ent.speed_v = -1*(ball_ent.speed_v);
2809:                                 ball_ent.y2d = 286;
2810: 
2811:                                 ball_ent.poisoned=0;
2812: 
2813:                                 if (!shielded)
2814:                                 {
2815:                                     stun=616;
2816:                                     health -= diff+1;
2817:                                     oslPlaySound(thunder);
2818:                                 }
2819: 
2820: 
2821:                                 returned=1;
2822:                         }
2823: 
2824:                     if ((ball_ent.x2d >= 480 - 16/2) || (ball_ent.x2d < 4))
2825:                     {
2826:                         ball_ent.speed_h = -1*(ball_ent.speed_h);
2827:                         if (ball_ent.x2d < 4) ball_ent.x2d = 6; else ball_ent.x2d = 478 - 16/2;
2828:                     }
2829: 
2830: 
2831:                 }
2832: 
2833:             }
2834: 
2835:         al_get_keyboard_state(&kbdstate);
2836: 
2837:         if (!al_key_down(&kbdstate, ALLEGRO_KEY_I) && !al_key_down(&kbdstate, ALLEGRO_KEY_O) && !al_key_down(&kbdstate, ALLEGRO_KEY_C) && !al_key_down(&kbdstate, ALLEGRO_KEY_P) && !al_key_down(&kbdstate, ALLEGRO_KEY_SPACE) && !al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL))
2838:         {
2839:             rebound=0;
2840:             swinging=0;
2841:             ulting=0;
2842:             frappe=-1;
2843:             frappe_ult=-1;
2844:         }
2845: 
2846:             if (((al_key_down(&kbdstate, ALLEGRO_KEY_I)) || (al_key_down(&kbdstate, ALLEGRO_KEY_O))) && (nbp==2) && (!rebound))
2847:             {
2848:                 att_ch_timer=0;
2849:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_I)) && (cursor2p > 0)) cursor2p--;
2850:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_O)) && (cursor2p < 13)) cursor2p++;
2851:                 rebound=1;
2852:             }
2853: 
2854:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_P)) && (pie_ent.pie_hp) && (health) && (!mgcd) && (counter > 256) && (!rebound))
2855:                 {
2856:                     rebound=1;
2857:                     if (!paused)
2858:                     {
2859:                         if (!lightsoff) oslStopSound(giygas[giyg_flag%3]);
2860:                         paused=1;
2861:                         if (al_get_sample_instance_position(quitter.instance))
2862:                         {
2863:                             health -= 5;
2864:                             if (putin) health -=2;
2865:                             oslStopSound(quitter);
2866:                         }
2867:                         if (al_get_sample_instance_position(tvnoisesound.instance)) oslStopSound(tvnoisesound);
2868:                         if (al_get_sample_instance_position(psis_sfx.instance)) oslStopSound(psis_sfx);
2869:                     }
2870:                     else
2871:                     {
2872:                         paused=0;
2873:                         oslPlaySound(giygas[giyg_flag%3]);
2874:                     }
2875: 
2876:                    
2877:                 }
2878: 
2879: 
2880:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_L)) && (paused))
2881:             {
2882:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_R)) && (al_key_down(&kbdstate, ALLEGRO_KEY_L)))
2883:                     {
2884:                         if ((al_key_down(&kbdstate, ALLEGRO_KEY_X)) && (al_key_down(&kbdstate, ALLEGRO_KEY_R)) && (al_key_down(&kbdstate, ALLEGRO_KEY_L)))
2885:                             {
2886:                                 paused=0;
2887:                                 health=0;
2888:                                 mort=2;
2889:                             }
2890: 
2891:                         if ((al_key_down(&kbdstate, ALLEGRO_KEY_N)) && (al_key_down(&kbdstate, ALLEGRO_KEY_R)) && (al_key_down(&kbdstate, ALLEGRO_KEY_L)))
2892:                             {
2893:                                 paused=0;
2894:                                 pie_ent.pie_hp=0;
2895:                                 pie_ent.pie_facemode=0;
2896:                             }
2897:                     }
2898:             }
2899: 
2900: 
2901:             counter++;
2902:             global_fr++;
2903:             if (nbp==2) att_ch_timer++; else att_ch_timer=4;
2904: 
2905:             if ((att_ch_timer >= 81) && (att_cooldowns[cursor2p] == 1) && (nbp==2))
2906:             {
2907:                 att_cooldowns[cursor2p]=0;
2908:             }
2909: 
2910: 
2911:             benj.stretchX = 32;
2912:             benj.stretchY = 48;
2913:             benj.angle = 0;
2914: 
2915:             if (stun > 600)
2916:             {
2917:                 lightning.trans=(stun%600)*16;
2918:                 temp_lghtn=oslSetImageTileSize(lightning,0,0,32,py+64);
2919:                 spr_draw(temp_lghtn, px, 0);
2920:             }
2921: 
2922: 
2923:             if (health > 0)
2924:             {
2925:                 shadow=oslSetImageTileSize(benj,32,192,32,48);
2926:                 shadow.trans=128;
2927:                 spr_draw(shadow, px+8, py+26);
2928:             }
2929: 
2930:             temp_benj=oslSetImageTileSize(benj,0,192,32,48);
2931: 
2932:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_C)) && (pie_ent.pie_hp > 0) && (health>0) && (!mgcd) && (!paused) && (frappe_ult<7) && (!stun) && (counter > 300) && (stary <= 0) && (!ulting) && (!rebound))
2933:             {
2934:                 frappe_ult=1;
2935:                 ulting=1;
2936:                 rebound=1;
2937:                 oslPlaySound(benj_sfx[(random(2)+8)]);
2938:                 racket_devnull++;
2939: 
2940:                 stary=py+48;
2941: 
2942:                 if ((ultlvl > 59) && (ultlvl < 120))
2943:                 {
2944:                     stars_ult[0]=px+32;
2945:                     nbult=1;
2946:                 }
2947: 
2948:                 else if ((ultlvl > 119) && (ultlvl < 239))
2949:                 {
2950:                         stars_ult[0]=px-48;
2951:                         stars_ult[1]=px+32;
2952:                         stars_ult[2]=px+112;
2953:                         nbult=3;
2954:                 }
2955: 
2956:                 else if (ultlvl==239)
2957:                 {
2958:                     stars_ult[0]=px-48;
2959:                     stars_ult[1]=px-8;
2960:                     stars_ult[2]=px+32;
2961:                     stars_ult[3]=px+72;
2962:                     stars_ult[4]=px+112;
2963:                     nbult=5;
2964:                 }
2965: 
2966: 
2967:             if (ultlvl > 59) ultlvl -= ((diff==1)?60:((diff==2)?(ultlvl%60+60):ultlvl));
2968: 
2969:             }
2970: 
2971:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_X)) && (health>0) && (!mgcd) && (!paused) && (shldlvl > 2) && (!stun))
2972:             {
2973:                 racket_devnull++;
2974:             }
2975: 
2976:             if (((al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) || (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE))) && (health>0) && (!mgcd) && (!paused) && (frappe<7) && (!stun) && (!rebound) && (!swinging))
2977:             {
2978:                 if (!(racket_devnull%2)) oslPlaySound(benj_sfx[random(3)+5]);
2979:                 racket_devnull++;
2980:                 frappe=1;
2981:                 rebound=1;
2982:                 swinging=1;
2983:             }
2984: 
2985:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_UP)) && (py >= 102) && (health>0) && (!mgcd) && (!paused) && (frappe == -1) && (!stun) && (mouth.stretchX == 10))
2986:             {
2987:                 if (pie_ent.pie_facemode != 1)
2988:                 {
2989:                     pbouss=0;
2990:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,0,32,48);
2991:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_UP))
2992:                         {
2993:                             if (pie_ent.pie_facemode != 3) py-=4; else py-=2;
2994:                             fs=3;
2995:                         }
2996:                 }
2997:                 else
2998:                 {
2999:                     pbouss=2;
3000:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,96,32,48);
3001:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_UP))
3002:                     {
3003:                         if (pie_ent.pie_facemode != 3) py+=4; else py+=2;
3004:                         fs=3;
3005:                     }
3006:                     if (py > 224) py=216;
3007:                 }
3008: 
3009:                 temp_pb=oslSetImageTileSize(powerball, 32, 0, 32, 32);
3010:                 if (!(counter%fs)) benj_frame++;
3011:             }
3012:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (!ulting) && (px >= (-0.492*py+94.184)) && (px <= (0.492*py+321.792)) && (health>0) && (!mgcd) && (!paused) && (frappe < 4) && (!stun) && (mouth.stretchX == 10))
3013:             {
3014:                 if (pie_ent.pie_facemode != 1)
3015:                 {
3016:                     pbouss=3;
3017:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,pbouss*48,32,48);
3018:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_LEFT))
3019:                     {
3020:                         if (frappe < 4)
3021:                         {
3022:                             if (pie_ent.pie_facemode != 3) px-=4; else px-=2;
3023:                         }
3024:                         fs=3;
3025:                     }
3026:                 }
3027:                 else
3028:                 {
3029:                     pbouss=1;
3030:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,48,32,48);
3031:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_LEFT))
3032:                     {
3033:                         if (frappe < 4)
3034:                         {
3035:                             if (pie_ent.pie_facemode != 3) px+=4; else px+=2;
3036:                         }
3037:                             fs=3;
3038:                     }
3039:                     if (px > (0.492*py+321.792)) px = (0.492*py+321.792);
3040:                 }
3041: 
3042:                     temp_pb=oslSetImageTileSize(powerball, 32, 0, 32, 32);
3043:                     if (!(counter%fs)) benj_frame++;
3044:             }
3045:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (!ulting) && (px >= (-0.492*py+94.184)) && (px <= (0.492*py+321.792)) && (health>0) && (!mgcd) && (!paused) && (frappe < 4) && (!stun) && (mouth.stretchX == 10))
3046:             {
3047:                 if (pie_ent.pie_facemode != 1)
3048:                 {
3049:                     pbouss=1;
3050:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,48,32,48);
3051:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT))
3052:                     {
3053:                         if (frappe < 4)
3054:                         {
3055:                             if (pie_ent.pie_facemode != 3) px+=4; else px+=2;
3056:                         }
3057:                             fs=3;
3058:                     }
3059:                 }
3060:                 else
3061:                 {
3062:                     pbouss=3;
3063:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,pbouss*48,32,48);
3064:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT))
3065:                     {
3066:                         if (frappe < 4)
3067:                         {
3068:                             if (pie_ent.pie_facemode != 3) px-=4; else px-=2;
3069:                         }
3070:                         fs=3;
3071:                     }
3072: 
3073:                     if (px < (-0.492*py+94.184)) px = (-0.492*py+94.184);
3074:                 }
3075:                     temp_pb=oslSetImageTileSize(powerball, 0, 0, 32, 32);
3076:                     if (!(counter%fs)) benj_frame++;
3077:             }
3078:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_DOWN)) && (py <= 224) && (health>0) && (!mgcd) && (!paused) && (frappe == -1) && (!stun) && (mouth.stretchX == 10))
3079:             {
3080:                 if (pie_ent.pie_facemode != 1)
3081:                 {
3082:                     pbouss=2;
3083:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,96,32,48);
3084:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_DOWN))
3085:                     {
3086:                         if (pie_ent.pie_facemode != 3) py+=4; else py+=2;
3087:                         fs=3;
3088:                     }
3089:                 }
3090:                 else
3091:                 {
3092:                     pbouss=0;
3093:                     temp_benj=oslSetImageTileSize(benj,(benj_frame%8)*32,0,32,48);
3094:                     if (al_key_down(&kbdstate, ALLEGRO_KEY_DOWN))
3095:                         {
3096:                             if (pie_ent.pie_facemode != 3) py-=4; else py-=2;
3097:                             fs=3;
3098:                         }
3099:                     if (py < 102) py=110;
3100:                 }
3101: 
3102:                     temp_pb=oslSetImageTileSize(powerball, 0, 0, 32, 32);
3103:                     if (!(counter%fs)) benj_frame++;
3104:             }
3105: 
3106:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) && (health>0) && (!mgcd) && (!paused) && (frappe<7) && (!stun) && (swinging))
3107:             {
3108:                 if ((!(counter%3))) frappe++;
3109:                 temp_benj=oslSetImageTileSize(benj,(frappe)*32,240,32,48);
3110: 
3111: 
3112:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (frappe > -1))
3113:                     {
3114:                         if (frappe>3) temp_benj.angle = 90;
3115:                         temp_benj=oslSetImageTileSize(benj,(frappe)*32,432,32,48);
3116: 
3117:                     }
3118:                 else if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (frappe > -1))
3119:                     {
3120:                         if (frappe>3) temp_benj.angle = -90;
3121:                         temp_benj=oslSetImageTileSize(benj,(frappe)*32,384,32,48);
3122:                     }
3123: 
3124:                 if (((px+24-(ball_ent.x2d))*(px+24-(ball_ent.x2d))+(py+24-(ball_ent.y2d))*(py+24-(ball_ent.y2d)) <= 404) && (!returned) && (py >= 142))
3125:                 {
3126:                     if (diff != 3) a=diff; else a=2;
3127:                     ball_ent = apply_impulse(ball_ent, a, a, (180-15*frappe)*3.14/180);
3128:                     oslPlaySound(bounce);
3129:                     frappe=-1;
3130:                     returned=1;
3131:                     //swinging=0;
3132:                 }
3133:             }
3134: 
3135: 
3136:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_SPACE)) && (health>0) && (!mgcd) && (!paused) && (frappe<7) && (!stun) && (swinging))
3137:             {
3138:                 if ((!(counter%3))) frappe++;
3139:                 temp_benj=oslSetImageTileSize(benj,(frappe)*32,288,32,48);
3140: 
3141: 
3142:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (frappe > -1))
3143:                     {
3144:                         if (frappe>3) temp_benj.angle = 90;
3145:                         temp_benj=oslSetImageTileSize(benj,(frappe)*32,432,32,48);
3146:                     }
3147:                 else if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (frappe > -1))
3148:                     {
3149:                         if (frappe>3) temp_benj.angle = -90;
3150:                         temp_benj=oslSetImageTileSize(benj,(frappe)*32,384,32,48);
3151:                     }
3152: 
3153:                 if (((px+36-(ball_ent.x2d))*(px+36-(ball_ent.x2d))+(py+36-(ball_ent.y2d))*(py+36-(ball_ent.y2d)) <= 404) && (!returned) && (py >= 142))
3154:                 {
3155:                     if (diff != 3) a=diff; else a=2;
3156:                     ball_ent = apply_impulse(ball_ent, -1*a, a, (15*frappe)*3.14/180);
3157:                     oslPlaySound(bounce);
3158:                     frappe=-1;
3159:                     returned=1;
3160:                     //swinging=0;
3161:                 }
3162:             }
3163: 
3164:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_X)) && (health>0) && (!mgcd) && (!paused) && (shldlvl > 0) && (!stun))
3165:             {
3166:                 if ((!shielded) && (shldlvl > 2)) oslPlaySound(benj_sfx[10]);
3167:                 if ((!(counter%(4-diff)))) shldlvl--;
3168:                 shielded=1;
3169:             }
3170: 
3171:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_C)) && (health>0) && (!mgcd) && (!paused) && (frappe_ult<7) && (!stun) && (counter > 300) && (!rebound) && (ulting))
3172:             {
3173:                 if (!(counter%3)) frappe_ult++;
3174:             }
3175: 
3176:             /*if ((frappe==7) && (swinging) && (!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL))  ||  (!al_key_down(&kbdstate, ALLEGRO_KEY_X)) ||  (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE)))
3177:             {
3178:                
3179:             }*/
3180: 
3181:             if ((!al_key_down(&kbdstate, ALLEGRO_KEY_X)) || (!shldlvl))
3182:             {
3183:                 shielded=0;
3184:             }
3185: 
3186:             if (stun)
3187:             {
3188:                 frappe=-1;
3189:                 temp_benj=oslSetImageTileSize(benj,64,192,32,48);
3190:                 stun--;
3191:                 if (!(stun%200)) stun=0;
3192:             }
3193: 
3194:             if (px < (-0.492*py+94.184)) px = (-0.492*py+94.184);
3195:             if (px > (0.492*py+321.792)) px = (0.492*py+321.792);
3196: 
3197:             if ((!al_key_down(&kbdstate, ALLEGRO_KEY_LCTRL)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_SPACE)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_X)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_C)) &&
3198:                 (!al_key_down(&kbdstate, ALLEGRO_KEY_UP)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_DOWN)) && (!al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)))
3199:             {
3200:                 benj_frame=0;
3201:             }
3202: 
3203: 
3204:             if ((frappe >= 7) && (swinging))
3205:             {
3206:                 frappe=7;
3207:                 rebound=1;
3208:             }
3209: 
3210:             if ((frappe_ult >= 7) && (ulting))
3211:             {
3212:                 frappe_ult=7;
3213:                 rebound=1;
3214:             }
3215: 
3216:             if (ulting) temp_benj=oslSetImageTileSize(ulting_gfx,(frappe_ult)*32,0,32,48);
3217: 
3218:             court_zoom = 0.00192*py + 0.562;
3219: 
3220:             temp_benj.stretchX = (int)(64*(float)court_zoom);
3221:             temp_benj.stretchY = (int)(96*(float)court_zoom);
3222: 
3223:             shield.stretchX = (int)(48*(float)court_zoom);
3224:             shield.stretchY = (int)(48*(float)court_zoom);
3225: 
3226: 
3227: 
3228:             ball_gfx.stretchX = (int)(8*(float)court_zoom);
3229:             ball_gfx.stretchY = ball_gfx . stretchX;
3230: 
3231:             temp_pb.stretchX = temp_pb.stretchY = (int)(32*(float)(court_zoom));
3232: 
3233: 
3234:             if (health > 0)
3235:             {
3236:                 if (stary > 0)
3237:                 {
3238:                     for(u=0; u<nbult; u++)
3239:                     {
3240:                         spr_draw(star, stars_ult[u], stary);
3241: 
3242:                         if (stary <= 136)
3243:                         {
3244:                             if ((stars_ult[u] >= (pie_ent.pie_x-128)) && (stars_ult[u] <= (pie_ent.pie_x+128))) pie_ent.pie_hp -= 10;
3245:                             stary=-64;
3246:                             stars_ult[u]=-32;
3247:                             nbult=0;
3248:                         }
3249: 
3250:                     }
3251:                     star.angle -= 5;
3252:                     stary -= 4;
3253: 
3254:                 }
3255: 
3256:                 if (ball_ent.poisoned) ball_gfx.R=ball_gfx.G=0;
3257:                 if (pie_ent.pie_hp > 0) draw_ball(ball_ent, ball_gfx, ball_shad);
3258:                 draw_benj(temp_benj, px, py, shielded, shield);
3259:                 if (((pbouss == 3) || (pbouss == 0)) && (pie_ent.pie_facemode == 3)) spr_draw(temp_pb, px+64, py+48);
3260:                 if (((pbouss == 1) || (pbouss == 2)) && (pie_ent.pie_facemode == 3)) spr_draw(temp_pb, px, py+48);
3261:                 if (ball_ent.poisoned) ball_gfx.R=ball_gfx.G=0;
3262: 
3263: 
3264:             }
3265: 
3266: 
3267: 
3268:             if (suppo)
3269:             {
3270:                 if (!paused) suppo--;
3271:                 if (suppo<40)
3272:                 {
3273:                     temp_suppo=oslSetImageTileSize(suppo_gfx, suppo/10*32, 0, 32, 32);
3274:                 }
3275: 
3276:                 if (suppo>110)
3277:                 {
3278:                     temp_suppo=oslSetImageTileSize(suppo_gfx, (150-suppo)/10*32, 0, 32, 32);
3279:                 }
3280: 
3281:                 court_zoom = 0.00192*suppoy + 0.562;
3282:                 temp_suppo.stretchX = (int)(32*(float)court_zoom);
3283:                 temp_suppo.stretchY = (int)(32*(float)court_zoom);
3284: 
3285:                 spr_draw(temp_suppo, suppox, suppoy);
3286:                 spr_draw(temp_suppo, suppox+64, suppoy);
3287: 
3288:                 if ((suppo>65) && (suppo<85))
3289:                 {
3290:                     if ((px>=suppox) && (px<=suppox+64) && (py>=suppoy-64) && (py <= suppoy))
3291:                     {
3292:                         temp_benj.R=0;
3293:                         temp_benj.G=128;
3294:                         temp_benj.B=128;
3295: 
3296:                         if ((suppo%4) < 2)
3297:                         {
3298:                             draw_benj(temp_benj, px, py, shielded, shield);
3299:                         }
3300: 
3301:                         if ((suppo == 67) && (!mgcd) && (!rckchscr))
3302:                         {
3303:                             health -= diff;
3304:                             oslPlaySound(elec);
3305:                         }
3306:                         temp_benj.R=temp_benj.G=temp_benj.B=255;
3307:                     }
3308:                 }
3309:             }
3310: 
3311:             if ((pie_ent.pie_hp > 25*round*diff) && (!giyg_flag) && (pie_ent.pie_hp <= 50*round*diff))
3312:             {
3313:                 giyg_flag=1;
3314:                 oslStopSound(giygas[0]);
3315:                 oslPlaySound(giygas[1]);
3316:             }
3317: 
3318: 
3319: 
3320:             if (round==2)
3321:             {
3322:                 giyg_bg[gbg].trans=random(64);
3323:                 spr_draw(giyg_bg[gbg], 240, 138);
3324: 
3325:                 giyg_bg_angles[0] = random(10)-5;
3326: 
3327:                 giyg_bg[gbg].angle += giyg_bg_angles[0];
3328: 
3329:                 if (pie_ent.pie_hp <= 50*round*diff)
3330:                 {
3331:                     giyg_bg_angles[1] = 2*(random(10)-5);
3332:                     giyg_bg[gbg].angle += giyg_bg_angles[1];
3333:                     giyg_bg[gbg].trans=random(64)+64;
3334:                     spr_draw(giyg_bg[gbg], 240, 138);
3335: 
3336:                 }
3337: 
3338:                 if (pie_ent.pie_hp <= 25*round*diff)
3339:                 {
3340:                     giyg_bg_angles[2] = 4*(random(10)-5);
3341:                     giyg_bg[gbg].angle += giyg_bg_angles[2];
3342:                     giyg_bg[gbg].trans=random(64)+128;
3343:                     spr_draw(giyg_bg[gbg], 240, 138);
3344: 
3345:                     if ((giyg_flag < 2))
3346:                     {
3347:                         giyg_flag=2;
3348:                         oslStopSound(giygas[1]);
3349:                         oslPlaySound(giygas[2]);
3350:                     }
3351: 
3352:                 }
3353:             }
3354: 
3355:             if (!(global_fr%5))
3356:             {
3357:                 gbg++;
3358:                 gbg=gbg%33;
3359:             }
3360: 
3361:             if ((counter >= 640))
3362:             {
3363: 
3364:                 //initializing attacks
3365:                 for (i=0; i<14; i++)
3366:                 {
3367:                     if ((nbp==1) && (!paused)) att_cooldowns[i]--;
3368:                     if ((nbp==2) && (!paused) && (att_cooldowns[i]>1)) att_cooldowns[i]--;
3369: 
3370:                     if ((i==7) && (bulbfell > 0)) att_cooldowns[7]++;
3371: 
3372:                     if ((att_cooldowns[i] <= 0) && (pie_ent.pie_hp > 0))
3373:                     {
3374: 
3375:                         attf=0;
3376:                         for (j=0; j<((2*diff)+2); j++)
3377:                         {
3378:                             if (pie_attacks[j][0] == (i+1)) attf=1;
3379:                         }
3380: 
3381:                             for (j=0; j<((2*diff)+2); j++)
3382:                             {
3383:                                 if ((!(pie_attacks[j][0])) && (!attf))
3384:                                 {
3385:                                     pie_attacks[j][0]=i+1;
3386: 
3387:                                     switch(i+1)
3388:                                     {
3389:                                         case 1:
3390:                                             pie_attacks[j][1]=140;
3391:                                         break;
3392: 
3393:                                         case 2:
3394:                                             pie_attacks[j][1]=(py-(pie_ent.pie_y))/(px-pie_ent.pie_x);
3395:                                             pie_attacks[j][2]=(pie_ent.pie_y)-pie_attacks[j][1]*pie_ent.pie_x;
3396:                                             pie_attacks[j][3]=pie_ent.pie_x;
3397:                                             pie_attacks[j][4]=px;
3398:                                             mgsy=pie_attacks[i][1]*pie_attacks[i][3]+pie_attacks[i][2];
3399:                                         break;
3400: 
3401:                                         case 3:
3402:                                             darkness=0;
3403:                                             for (u=0; u<((2*diff)+2); u++)
3404:                                             {
3405:                                                 if (pie_attacks[u][0]==7) darkness=1;
3406:                                             }
3407: 
3408:                                             if (!darkness)
3409:                                             {
3410:                                                 pie_attacks[j][1]=360-(15*diff);
3411:                                                 pie_attacks[j][2]=random(160)+80;
3412:                                                 pie_attacks[j][3]=random(112)+160;
3413:                                                 pie_attacks[j][4]=2*diff+3;
3414:                                             }
3415:                                             else pie_attacks[j][0]=0;
3416:                                         break;
3417: 
3418:                                         case 4:
3419:                                             pie_attacks[j][1]=diff*166;
3420:                                             lightsoff=1;
3421:                                         break;
3422: 
3423:                                         case 5:
3424:                                             pie_attacks[j][1]=-218;
3425:                                             pie_attacks[j][2]=255;
3426:                                         break;
3427: 
3428:                                         case 6:
3429:                                             pie_attacks[j][1]=225*diff;
3430:                                             pie_attacks[j][2]=random(416);
3431:                                             pie_attacks[j][3]=random(100)+108;
3432: 
3433:                                             if ((diff > 1) && (pie_attacks[j][2]%diff))
3434:                                             {
3435:                                                 pie_attacks[j][2] += (diff)-(pie_attacks[j][2]%diff);
3436:                                             }
3437: 
3438:                                             if ((diff > 1) && (pie_attacks[j][3]%diff))
3439:                                             {
3440:                                                 pie_attacks[j][3] += (diff)-(pie_attacks[j][3]%diff);
3441:                                             }
3442:                                         break;
3443: 
3444:                                         case 7:
3445:                                             chair=0;
3446:                                             for (u=0; u<((2*diff)+2); u++)
3447:                                             {
3448:                                                 if (pie_attacks[u][0]==3) chair=1;
3449:                                             }
3450: 
3451:                                             if (!chair)
3452:                                             {
3453: 
3454:                                             if (px+16 < 240) pie_attacks[j][1]=0; else pie_attacks[j][1]=1;
3455:                                             pie_attacks[j][2]=random(400)+600;
3456:                                             if (pie_attacks[j][1]) pie_attacks[j][3]=400-random(160); else  pie_attacks[j][3]=random(160)+80;
3457:                                             if (pie_attacks[j][1]) pie_attacks[j][4]=480; else  pie_attacks[j][4]=0;
3458: 
3459:                                             mouth.stretchX = 10;
3460:                                             mouth.stretchY = 16;
3461:                                             }
3462:                                             else  pie_attacks[j][0]=0;
3463: 
3464:                                         break;
3465: 
3466:                                         case 8:
3467:                                             pie_attacks[j][1]=diff+2;
3468:                                             pie_attacks[j][2]=random(4); //sens bulbasaur
3469:                                             pie_attacks[j][3]=random(320)+80; //bulb_x
3470:                                             pie_attacks[j][4]=-64; //bulb_y
3471:                                             bulbfell=1;
3472:                                             if (!lightsoff) oslPlaySound(bulbsfx[(random(2)?1:6)]);
3473:                                         break;
3474: 
3475:                                         case 9:
3476:                                             pie_attacks[j][1]=120*diff+120;
3477:                                             if (px < 240) pie_attacks[j][2]=1; else pie_attacks[j][2]=0;
3478:                                             pie_attacks[j][3]=py;
3479: 
3480:                                             for (u=0; u<3; u++)
3481:                                             {
3482:                                                 meteors[u][0]=0;
3483:                                                 meteors[u][1]=0;
3484:                                                 meteors[u][2]=0;
3485:                                             }
3486:                                         break;
3487: 
3488:                                         case 10:
3489:                                             pie_attacks[j][1]=96;
3490:                                             if ((!shielded) && (!stun)) stun=96;
3491:                                             break;
3492: 
3493:                                         case 11:
3494:                                             pie_attacks[j][1]=1;
3495:                                             pie_attacks[j][2]=30;
3496:                                             if (!lightsoff) oslPlaySound(psis_sfx);
3497:                                             break;
3498: 
3499:                                         case 12:
3500:                                             pie_attacks[j][1]=240*diff;
3501:                                             pie_ent.pie_facemode=random(4);
3502:                                             if ((!lightsoff) && (health > 0)) oslPlaySound(dictators_sfx[pie_ent.pie_facemode]);
3503:                                             if (pie_ent.pie_facemode==1)
3504:                                             {
3505:                                                 pie_attacks[j][2]=560;
3506:                                             }
3507:                                             break;
3508: 
3509:                                         case 13:
3510:                                             if ((round==2) && (pie_ent.pie_hp < 20*round*diff) && (!ulted) && (!lightsoff))
3511:                                             {
3512:                                                 oslStopSound(giygas[giyg_flag]);
3513:                                                 oslStopSound(psis_sfx);
3514:                                                 oslEndDrawing();
3515:                                                 health=shoop_da_whoop(health, round, diff);
3516:                                                 oslStartDrawing();
3517:                                                 ulted=1;
3518:                                                 oslPlaySound(giygas[giyg_flag]);
3519:                                                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
3520:                                             }
3521:                                             pie_attacks[j][0]=0;
3522:                                             break;
3523: 
3524:                                         case 14:
3525:                                             if ((round==2) && (pie_ent.pie_hp < 10*round*diff) && (ulted==1) && (!lightsoff))
3526:                                             {
3527:                                                 oslStopSound(giygas[giyg_flag]);
3528:                                                 oslStopSound(psis_sfx);
3529:                                                 oslEndDrawing();
3530:                                                 sad();
3531:                                                 oslStartDrawing();
3532:                                                 ulted=2;
3533:                                                 oslPlaySound(giygas[giyg_flag]);
3534:                                                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
3535:                                             }
3536:                                             pie_attacks[j][0]=0;
3537:                                             break;
3538: 
3539: 
3540:                                         default:
3541:                                             break;
3542:                                     }
3543: 
3544:                                     j=2*diff+3; //break;
3545:                                 }
3546:                             }
3547: 
3548: 
3549:                             //att_cooldowns[i]=(random((8-(diff*2)))*100+random(3*diff)*100+800)*(2*i+11);
3550:                                 att_cooldowns[i]=(random((8-(diff*2)))*100+random(3*diff)*100+800);
3551:                                 att_cooldowns[i] += (((i==0) || (i==3) || (i==4))?9*att_cooldowns[i]:0) + 2*random((int)(((i!=0)?1.5:3.5)*att_cooldowns[i]));
3552:                                 if ((i!=0) && (i!=3) && (i!=4)) att_cooldowns[i]=att_cooldowns[i]/(0.5*round+0.5);
3553:                                 if (i == 11) att_cooldowns[i] += 1792;
3554: 
3555:                     }
3556:                 }
3557: 
3558: 
3559:                 //programming attacks
3560: 
3561: 
3562:                 if (!paused) {
3563: 
3564:                     for (i=0; i<((2*diff)+2); i++)
3565:                     {
3566:                         switch(pie_attacks[i][0])
3567:                         {
3568:                             case 1:
3569:                             {
3570:                                 if ((mgcd < 1) && (health > 0) && (!lightsoff))
3571:                                 {
3572:                                     ko.R=0;
3573:                                     ko.B=ko.G=128;
3574:                                     ko.trans=255;
3575:                                     if (pie_attacks[i][1] > 115)
3576:                                     {
3577:                                         temp_ko=oslSetImageTileSize(ko,0,0,120,96);
3578:                                         spr_draw(temp_ko, (int)(9.6*(140-pie_attacks[i][1])-120), 88);
3579:                                     }
3580: 
3581:                                     if ((pie_attacks[i][1] <= 115) && (pie_attacks[i][1] >= 90))
3582:                                     {
3583:                                         temp_ko=oslSetImageTileSize(ko,0,0,120,96);
3584:                                         spr_draw(temp_ko, 120, 88);
3585:                                         temp_ko=oslSetImageTileSize(ko,120,0,120,96);
3586:                                         spr_draw(temp_ko, (int)(-9.6*(140-pie_attacks[i][1])+720), 88);
3587:                                     }
3588: 
3589:                                     if ((pie_attacks[i][1] > 0) && (pie_attacks[i][1] < 90))
3590:                                     {
3591:                                         temp_ko=oslSetImageTileSize(ko,0,0,240,96);
3592:                                         spr_draw(temp_ko, 120, 88);
3593:                                     }
3594: 
3595:                                     if ((pie_attacks[i][1] <= 0))
3596:                                     {
3597:                                         pie_attacks[i][0]=0;
3598:                                     }
3599: 
3600:                                     if (pie_attacks[i][1] > 80)
3601:                                     {
3602:                                         if ((pie_attacks[i][1]%6) < 3)
3603:                                         {
3604:                                             explode.stretchX = 64;
3605:                                             explode.stretchY = 96;
3606:                                             spr_draw(explode, px, py);
3607:                                         }
3608:                                         else
3609:                                         {
3610:                                             explode.stretchX = 32;
3611:                                             explode.stretchY = 48;
3612:                                             spr_draw(explode, px+16, py+24);
3613:                                         }
3614:                                     }
3615: 
3616:                                     pie_attacks[i][1]--;
3617:                                     //oslSetAlpha(OSL_FX_DEFAULT, 0);
3618:                                 }
3619:                                 break;
3620:                             }
3621: 
3622:                             case 2:
3623:                             {
3624:                                 //frame_debug(j);
3625: 
3626:                                 if ((!mgcd) && (!lightsoff))
3627:                                 {
3628:                                     mgswirl.trans=128;
3629: 
3630:                                     if (pie_attacks[i][4] < pie_attacks[i][3])
3631:                                         {
3632:                                             pie_attacks[i][4]-=3;
3633:                                             pie_attacks[i][3]-=3;
3634:                                         }
3635:                                     else
3636:                                         {
3637:                                             pie_attacks[i][4]+=3;
3638:                                             pie_attacks[i][3]+=3;
3639:                                         }
3640: 
3641:                                     if (mgsy < py)  mgsy += random(8)+2;    else mgsy -= random(8)+2;
3642: 
3643:                                     court_zoom = 0.00192*(mgsy) + 0.562;
3644: 
3645:                                     mgswirl.stretchX = (int)(128*(float)court_zoom);
3646:                                     mgswirl.stretchY = (int)(128*(float)court_zoom);
3647: 
3648:                                     spr_draw(mgswirl, pie_attacks[i][3], mgsy);
3649:                                 }
3650: 
3651:                                 if ((swirl_collide(px, py, pie_attacks[i][3], mgsy)) && (health>0))
3652:                                 {
3653: 
3654:                                         if (!mgcd)
3655:                                         {
3656:                                             al_set_sample_instance_position(minigametime.instance,16);
3657:                                             oslStopSound(giygas[giyg_flag%3]);
3658:                                             oslPlaySound(minigametime);
3659:                                             if (al_get_sample_instance_position(tvnoisesound.instance)) oslStopSound(tvnoisesound);
3660:                                             if  (al_get_sample_instance_position(meteor_fall.instance)) oslStopSound(meteor_fall);
3661:                                             oslStopSound(psis_sfx);
3662:                                             sleepwell.stretchX = sleepwell. stretchY = 272;
3663:                                         }
3664: 
3665:                                         mgcd++;
3666: 
3667:                                         if (mgcd >= 1)
3668:                                         {
3669: 
3670:                                                 oslStopSound(psis_sfx);
3671:                                                 if (mgcd < 9) oslDrawFillRect(0,0,480,272, _RGB(255,255,255)); else
3672:                                                 {
3673:                                                     oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
3674:                                                     sleepwell.trans=255-((int)(mgcd*2.55));
3675:                                                     sleepwell.stretchX+=18;
3676:                                                     sleepwell.stretchY+=36;
3677:                                                     spr_draw(sleepwell,240,138);
3678:                                                     sleepwell.trans=255;
3679:                                                 }
3680: 
3681: 
3682:                                         }
3683: 
3684:                                 }
3685: 
3686:                                 if ((pie_attacks[i][3] <= -128) || (pie_attacks[i][3] >= 544))
3687:                                 {
3688:                                     pie_attacks[i][0]=0;
3689:                                     mgcd=0;
3690:                                 }
3691: 
3692: 
3693:                                 break;
3694:                             }
3695: 
3696:                             case 3:
3697:                             {
3698:                                 if ((mgcd < 1) && (health > 0) && (!lightsoff))
3699:                                         {
3700: 
3701:                                         if (pie_attacks[i][4] > 0)
3702:                                         {
3703:                                                 pie_attacks[i][1]--;
3704: 
3705:                                                 if (pie_attacks[i][1] > 90)
3706:                                                 {
3707: 
3708:                                                     if (pie_attacks[i][1] < 180) rckch[0].angle = (int)(6*sin(0.5*counter));
3709:                                                     else rckch[0].angle = 0;
3710: 
3711:                                                     court_zoom = 0.00192*(pie_attacks[i][3]+15) + 0.562;
3712:                                                     rckch[0].stretchX = (int)(64*(float)court_zoom);
3713:                                                     rckch[0].stretchY = (int)(64*(float)court_zoom);
3714: 
3715:                                                     spr_draw(rckch[0], pie_attacks[i][2], pie_attacks[i][3]+15);
3716: 
3717:                                                     if ((((px-pie_attacks[i][2])*(px-pie_attacks[i][2])+(py-pie_attacks[i][3])*(py-pie_attacks[i][3])) <= 3000) & (frappe >= 1))
3718:                                                     {
3719:                                                         if (swinging)
3720:                                                         {
3721:                                                         rckch[0].B=0;
3722:                                                         spr_draw(rckch[0], pie_attacks[i][2], pie_attacks[i][3]+15);
3723:                                                         rckch[0].B=255;
3724:                                                             pie_attacks[i][4]--;
3725:                                                             //if (osl_keys . held.triangle) pie_attacks[i][4]=0;
3726:                                                             oslPlaySound(paf);
3727:                                                             ultlvl += 5-diff;
3728:                                                             frappe=-1;
3729:                                                         swinging=0;
3730:                                                         }
3731:                                                     }
3732: 
3733:                                                     if (pie_attacks[i][4] <= 0) pie_attacks[i][1]=20;
3734:                                                 }
3735:                                                 else
3736:                                                 {
3737:                                                     if (pie_attacks[i][1] > 59)
3738:                                                     {
3739:                                                         rckch[1].stretchX = (90-pie_attacks[i][1])*16;
3740:                                                         rckch[1].stretchY = (int)(0.567 * (rckch[1] . stretchX));
3741:                                                         rckch[1].angle = ((pie_attacks[i][1]-30)*12);
3742:                                                     }
3743:                                                     if (pie_attacks[i][1] == 59)
3744:                                                     {
3745:                                                         rckch[1].angle = 0;
3746:                                                         rckch[1].stretchX = 480;
3747:                                                         rckch[1].stretchY = 272;
3748:                                                         rckchscr=1;
3749:                                                         oslPlaySound(quitter);
3750:                                                     }
3751:                                                     spr_draw(rckch[1], 240+random(8)-4, 136+random(8)-4);
3752:                                                     if (!(pie_attacks[i][1]%36) && (!shielded))
3753:                                                     {
3754:                                                         health--;
3755:                                                         if (putin) health--;
3756:                                                     }
3757:                                                 }
3758: 
3759:                                                 if (pie_attacks[i][1] <= -180)
3760:                                                 {
3761: 
3762:                                                     oslStopSound(quitter);
3763:                                                     pie_attacks[i][0]=0;
3764:                                                     rckchscr=0;
3765: 
3766:                                                 }
3767: 
3768:                                                 if (py > ((pie_attacks[i][3]-62)*court_zoom))
3769:                                                 {
3770:                                                     temp_benj.trans=255;
3771:                                                     draw_benj(temp_benj, px, py, shielded, shield);
3772:                                                 }
3773: 
3774: 
3775:                                             }
3776:                                         else
3777:                                             {
3778:                                                 if (pie_attacks[i][1]==20) oslPlaySound(expl_sound2);
3779:                                                 explode.stretchX = explode.stretchY = 20 - pie_attacks[i][1];
3780:                                                 spr_draw(explode, pie_attacks[i][2], pie_attacks[i][3]);
3781:                                                 pie_attacks[i][1]--;
3782:                                                 if (pie_attacks[i][1]==0)
3783:                                                 {
3784:                                                     pie_attacks[i][0]=0;
3785:                                                 }
3786: 
3787:                                             }
3788:                                         }
3789: 
3790: 
3791:                                 break;
3792:                             }
3793: 
3794:                             case 4:
3795:                             {
3796:                                 if ((mgcd < 1) && (health > 0))
3797:                                 {
3798:                                     if ((pie_attacks[i][1] == diff*166) || (pie_attacks[i][1] == 0))
3799:                                     {
3800:                                          oslStopSound(giygas[giyg_flag%3]);
3801:                                     }
3802:                                     if (lightsoff)
3803:                                     {
3804:                                         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
3805:                                         draw_benj(temp_benj, px, py, shielded, shield);
3806: 
3807: 
3808:                                         for (u=0; u<(2*diff+2); u++)
3809:                                         {
3810:                                             if (pie_attacks[u][0] != 4)
3811:                                                 {
3812:                                                     pie_attacks[u][0]=0;
3813:                                                 }
3814:                                         }
3815:                                     }
3816:                                 }
3817: 
3818:                                  if (!pie_attacks[i][1])
3819:                                      {
3820:                                         lightsoff=0;
3821:                                         pie_attacks[i][0]=0;
3822:                                         oslPlaySound(giygas[giyg_flag%3]);
3823:                                      }
3824: 
3825:                                 pie_attacks[i][1]--;
3826:                                 break;
3827:                             }
3828: 
3829:                             case 5:
3830:                             {
3831:                                 if ((mgcd < 1) && (health > 0))
3832:                                 {
3833:                                     if (pie_attacks[i][1] < (px-108))
3834:                                         {
3835:                                             spr_draw(psycho, pie_attacks[i][1], abs(32*sin(0.0125*3.14*pie_attacks[i][1]))+8);
3836:                                         }
3837:                                     else
3838:                                         {
3839: 
3840:                                             if (pie_attacks[i][2] > 2) pie_attacks[i][2]-=2; else pie_attacks[i][0]=0;
3841:                                             oslDrawFillRect(0,0,480,272, _RGBA(255,255,255,pie_attacks[i][2]));
3842:                                         }
3843:                                     pie_attacks[i][1]+=4;
3844:                                 }
3845:                                 break;
3846:                             }
3847: 
3848:                             case 6:
3849:                             {
3850:                                 if ((mgcd < 1) && (health > 0))
3851:                                 {
3852: 
3853:                                     if (pie_attacks[i][1] < 51)
3854:                                     {
3855:                                         if ((pie_attacks[i][1])%4 < 3)
3856:                                             {
3857:                                                 visor.R=0;
3858:                                                 visor.G=0;
3859:                                                 visor.trans=192;
3860:                                             }
3861:                                         else
3862:                                             {
3863:                                                 visor.R=visor.G=visor.B=visor.trans=255;
3864:                                             }
3865:                                     }
3866:                                     else
3867:                                     {
3868:                                         visor.R=255;
3869:                                         visor.G=255;
3870:                                         visor.trans=255;
3871:                                     }
3872: 
3873:                                     if (pie_attacks[i][1] > 0) spr_draw(visor, pie_attacks[i][2], pie_attacks[i][3]);
3874: 
3875: 
3876: 
3877:                                     if (px+32 < pie_attacks[i][2])
3878:                                         {
3879:                                             pie_attacks[i][2] -= diff;
3880:                                         }
3881:                                     else if (px+32 > pie_attacks[i][2])
3882:                                         {
3883:                                             pie_attacks[i][2] += diff;
3884:                                         }
3885: 
3886:                                     if (py+48 < pie_attacks[i][3])
3887:                                         {
3888:                                             pie_attacks[i][3] -= diff;
3889:                                         }
3890:                                     else if (py+48 > pie_attacks[i][3])
3891:                                         {
3892:                                             pie_attacks[i][3] += diff;
3893:                                         }
3894: 
3895: 
3896:                                     pie_attacks[i][1]--;
3897: 
3898:                                     if (!pie_attacks[i][1])
3899:                                     {
3900:                                         oslPlaySound(pew);
3901:                                         if ((pie_attacks[i][2] >= px-16) && (pie_attacks[i][2] <= px+80) && (pie_attacks[i][3] >= py+24) && (pie_attacks[i][3] <= py+72) && (!shielded))
3902:                                         {
3903:                                             health -= 2*diff+6;
3904:                                             if (putin) health -= 3;
3905:                                             oslPlaySound(benj_sfx[random(5)]);
3906:                                         }
3907:                                     }
3908: 
3909:                                     if (pie_attacks[i][1] < 0)
3910:                                     {
3911:                                         explode.stretchX = explode.stretchY = 20 + 2*pie_attacks[i][1];
3912:                                         spr_draw(explode, pie_attacks[i][2], pie_attacks[i][3]);
3913: 
3914:                                         if (pie_attacks[i][1] == -10) pie_attacks[i][0]=0;
3915:                                     }
3916:                                 }
3917:                                 break;
3918:                             }
3919: 
3920: 
3921: 
3922:                             case 8:
3923:                             {
3924:                                 if ((mgcd < 1) && (health > 0))
3925:                                 {
3926:                                     if (bulbfell==1)
3927:                                     {
3928:                                         temp_bulb=oslSetImageTileSize(bulbasaur, 0, 128, 64, 64);
3929:                                         court_zoom = 0.00192*pie_attacks[i][4] + 0.562;
3930:                                         temp_bulb.stretchX = (int)(64*(float)court_zoom);
3931:                                         temp_bulb.stretchY = (int)(64*(float)court_zoom);
3932: 
3933:                                         spr_draw(temp_bulb, pie_attacks[i][3], pie_attacks[i][4]);
3934:                                         pie_attacks[i][4] += 8;
3935:                                         if (pie_attacks[i][4] >= 136)
3936:                                         {
3937:                                             pie_attacks[i][4]=136;
3938:                                             bulbfell=2;
3939:                                         }
3940: 
3941:                                         if (py > ((pie_attacks[i][4])*court_zoom))
3942:                                         {
3943:                                             draw_benj(temp_benj, px, py, shielded, shield);
3944:                                         }
3945:                                     }
3946: 
3947:                                     else if (bulbfell==2)
3948:                                     {
3949:                                         if (pie_attacks[i][2] != 4)
3950:                                         {
3951:                                             temp_bulb=oslSetImageTileSize(bulbasaur, bulbfs*64, pie_attacks[i][2]*64, 64, 64);
3952:                                         }
3953:                                         else
3954:                                         {
3955: 
3956:                                             if (abs(pie_attacks[i][3]-px) > abs(pie_attacks[i][4]-py))
3957:                                             {
3958:                                                 if (pie_attacks[i][3] > px)
3959:                                                 {
3960:                                                     temp_bulb=oslSetImageTileSize(bulbasaur, 0, 192, 64, 64);
3961:                                                 }
3962:                                                 else
3963:                                                 {
3964:                                                     temp_bulb=oslSetImageTileSize(bulbasaur, 0, 64, 64, 64);
3965:                                                 }
3966:                                             }
3967:                                             else
3968:                                             {
3969:                                                 if (pie_attacks[i][4] > py)
3970:                                                 {
3971:                                                     temp_bulb=oslSetImageTileSize(bulbasaur, 0, 0, 64, 64);
3972:                                                 }
3973:                                                 else
3974:                                                 {
3975:                                                     temp_bulb=oslSetImageTileSize(bulbasaur, 0, 128, 64, 64);
3976:                                                 }
3977:                                             }
3978:                                         }
3979: 
3980:                                         court_zoom = 0.00192*pie_attacks[i][4] + 0.562;
3981:                                         temp_bulb.stretchX = (int)(64*(float)court_zoom);
3982:                                         temp_bulb.stretchY = (int)(64*(float)court_zoom);
3983: 
3984:                                         spr_draw(temp_bulb, pie_attacks[i][3], pie_attacks[i][4]);
3985: 
3986:                                         if (!(counter%52) && ((counter%416) < 364))
3987:                                         {
3988:                                             pie_attacks[i][2]=random(4);
3989:                                         }
3990:                                         else
3991:                                         {
3992:                                             switch(pie_attacks[i][2])
3993:                                             {
3994:                                                 case 0:
3995:                                                 if (pie_attacks[i][4] > 128) pie_attacks[i][4] -= 2; else pie_attacks[i][2]=2;
3996:                                                 break;
3997: 
3998:                                                 case 1:
3999:                                                 if (pie_attacks[i][3] < 400) pie_attacks[i][3] += 2; else pie_attacks[i][2]=3;
4000:                                                 break;
4001: 
4002:                                                 case 2:
4003:                                                 if (pie_attacks[i][4] < 240) pie_attacks[i][4] += 2; else pie_attacks[i][2]=0;
4004:                                                 break;
4005: 
4006:                                                 case 3:
4007:                                                 if (pie_attacks[i][3] > 80) pie_attacks[i][3] -= 2; else pie_attacks[i][2]=1;
4008:                                                 break;
4009:                                             }
4010:                                         }
4011: 
4012: 
4013: 
4014:                                         if ((counter%416) >= 364)
4015:                                         {
4016:                                             pie_attacks[i][2]=4;
4017: 
4018:                                             if ((counter%416) == 364) oslPlaySound(bulbsfx[random(3)+3]);
4019: 
4020:                                             if (pie_attacks[i][3] > px) pie_attacks[i][3] -= 4; else pie_attacks[i][3] += 4;
4021:                                             if (pie_attacks[i][4] > py) pie_attacks[i][4] -= 2; else if (pie_attacks[i][4] < 238) pie_attacks[i][4] += 2;
4022: 
4023:                                         }
4024: 
4025: 
4026: 
4027:                                         if ((((px-pie_attacks[i][3])*(px-pie_attacks[i][3])+(py-pie_attacks[i][4])*(py-pie_attacks[i][4])) <= 64) && (pie_attacks[i][2]==4) && (!shielded))
4028:                                         {
4029:                                             if (!stun) stun=200+3*diff;
4030:                                             pie_attacks[i][2]=random(4);
4031:                                             health -= diff+1;
4032:                                             if (putin) health -= diff;
4033:                                             oslPlaySound(benj_sfx[random(5)]);
4034:                                             counter += (counter%417)+1;
4035:                                             oslPlaySound(bulbsfx[0]);
4036:                                         }
4037: 
4038:                                         if ((((px-pie_attacks[i][3])*(px-pie_attacks[i][3])+(py-pie_attacks[i][4])*(py-pie_attacks[i][4])) <= 1500) && (frappe >= 1))
4039:                                         {
4040:                                             if (swinging)
4041:                                             {
4042:                                             temp_bulb.B=0;
4043:                                             spr_draw(temp_bulb, pie_attacks[i][3], pie_attacks[i][4]);
4044:                                             ultlvl += 5-diff;
4045:                                             temp_bulb.B=255;
4046:                                                 pie_attacks[i][1]--;
4047:                                                 //if (osl_keys . held.triangle) pie_attacks[i][4]=0;
4048:                                                 oslPlaySound(paf);
4049:                                                 frappe=-1;
4050:                                                 swinging=0;
4051:                                             }
4052: 
4053:                                         }
4054: 
4055:                                         bulbfs=(counter%20)/5;
4056: 
4057:                                         if (py > ((pie_attacks[i][4])*court_zoom))
4058:                                         {
4059:                                             //oslSetAlpha(OSL_FX_DEFAULT, 0);
4060:                                             draw_benj(temp_benj, px, py, shielded, shield);
4061:                                         }
4062:                                     }
4063: 
4064:                                     if (pie_attacks[i][1] <= 0)
4065:                                     {
4066:                                         bulbfell=0;
4067:                                         if (!pie_attacks[i][1]) oslPlaySound(bulbsfx[2]);
4068:                                         pie_attacks[i][2]=4;
4069:                                         pie_attacks[i][1]--;
4070: 
4071:                                         if (pie_attacks[i][1] == -35)
4072:                                         {
4073:                                             pie_attacks[i][0]=0;
4074:                                         }
4075: 
4076:                                         bulbfs=(abs(pie_attacks[i][1]))/9;
4077:                                         temp_bulb=oslSetImageTileSize(temp_bulb, bulbfs*64, pie_attacks[i][2]*64, 64, 64);
4078:                                         spr_draw(temp_bulb, pie_attacks[i][3], pie_attacks[i][4]);
4079: 
4080:                                     }
4081: 
4082:                                 }
4083:                                 break;
4084: 
4085:                             case 9:
4086:                             {
4087: 
4088:                                 if ((mgcd <1) && (!lightsoff))
4089:                                 {
4090:                                     if (pie_attacks[i][1] == 120*diff+120)
4091:                                     {
4092: 
4093: 
4094:                                         for(u=0; u<3; u++)
4095:                                         {
4096:                                             meteors[u][1] = random(176);
4097:                                             if (pie_attacks[i][2]) meteors[u][0]=-48; else meteors[u][0]=480;
4098:                                             meteors[u][2] = random(3)+1;
4099:                                         }
4100: 
4101:                                         oslPlaySound(meteor_fall);
4102:                                     }
4103:                                     else
4104:                                     {
4105:                                         if (!al_get_sample_instance_position(meteor_fall.instance)) oslPlaySound(meteor_fall);
4106: 
4107:                                         for(u=0; u<3; u++)
4108:                                         {
4109: 
4110:                                             temp_met=oslSetImageTileSize(meteor, u*48, 0, 48, 48);
4111:                                             temp_met.stretchX = temp_met.stretchY = 12*meteors[u][2];
4112:                                             spr_draw(temp_met, meteors[u][0], meteors[u][1]);
4113: 
4114:                                             if (pie_attacks[i][2]) meteors[u][0]+=random(9)+1; else meteors[u][0]-=random(9)+1;
4115: 
4116:                                             meteors[u][1]+=4;
4117: 
4118:                                             if ((meteors[u][1] < pie_attacks[i][3]+32) && (meteors[u][1] >= pie_attacks[i][3]))
4119:                                             {
4120:                                                 explode . stretchX = explode . stretchY = 48;
4121:                                                 spr_draw(explode, meteors[u][0], meteors[u][1]);
4122:                                                 oslPlaySound(expl_sound2);
4123:                                             }
4124: 
4125:                                             if (meteors[u][1] >= pie_attacks[i][3]+32)
4126:                                             {
4127:                                                 if (((px-meteors[u][0])*(px-meteors[u][0])+(py+32-meteors[u][1])*(py+32-meteors[u][1]) <= 196) && (!shielded))
4128:                                                 {
4129:                                                     oslPlaySound(expl_sound2);
4130:                                                     health -= round;
4131:                                                     if (putin) health -= round;
4132:                                                     oslPlaySound(benj_sfx[random(5)]);
4133:                                                 }
4134: 
4135:                                                 if (pie_attacks[i][1] <= 0) meteors[u][2]=0; else meteors[u][2] = random(3)+1;
4136:                                                 meteors[u][1]=random(176);
4137:                                                 if (pie_attacks[i][2]) meteors[u][0]=-48; else meteors[u][0]=480;
4138: 
4139:                                             }
4140:                                         }
4141:                                     }
4142: 
4143:                                     pie_attacks[i][1]--;
4144: 
4145:                                     if (pie_attacks[i][1] == 0)
4146:                                         {
4147:                                             oslStopSound(meteor_fall);
4148:                                         }
4149: 
4150:                                     if (meteors[0][2]+meteors[1][2]+meteors[2][2] == 0) pie_attacks[i][0]=0;
4151:                                     }
4152:                                 }
4153:                                 break;
4154: 
4155:                             case 10:
4156:                             {
4157:                                 if ((mgcd <1) && (!lightsoff))
4158:                                 {
4159:                                     if (!shielded)
4160:                                     {
4161: 
4162:                                         if (pie_attacks[i][1] == 96)
4163:                                         {
4164:                                             stunning.stretchX = stunning.stretchY = 24;
4165:                                             oslPlaySound(stun_sound);
4166:                                         }
4167: 
4168: 
4169:                                         for (u=0; u<135; u++)
4170:                                         {
4171:                                             stunning.R=0;
4172:                                             stunning.trans=192;
4173:                                             if (stunning.stretchX > 4) spr_draw(stunning, (u%15)*32+12, ((int)(u/15))*32+12);
4174:                                             stunning.R = stunning.trans = 255;
4175:                                         }
4176:                                     }
4177: 
4178:                                     pie_attacks[i][1]--;
4179: 
4180:                                     if (!((pie_attacks[i][1])%8))
4181:                                     {
4182:                                         if (stunning.stretchX > 4)
4183:                                         {
4184:                                             stunning.stretchX -= 4;
4185:                                             stunning.stretchY -= 4;
4186:                                         }
4187:                                     }
4188: 
4189:                                     if (!(pie_attacks[i][1]))
4190:                                     {
4191:                                         pie_attacks[i][0]=0;
4192:                                     }
4193:                                 }
4194:                                 break;
4195:                             }
4196: 
4197:                             case 11:
4198:                             {
4199:                                 if ((mgcd <1) && (!lightsoff) && (health > 0))
4200:                                 {
4201:                                     if (pie_attacks[i][2] > 0)
4202:                                     {
4203:                                         temp_psis=oslSetImageTileSize(psis, ((int)(counter%18)/6)*16, 0, 16, 32);
4204:                                         temp_psis=oslSetImageRotCenter(temp_psis);
4205: 
4206:                                         temp_psis.angle = pie_attacks[i][1];
4207: 
4208:                                         court_zoom = 0.00192*(py+24) + 0.562;
4209:                                         psis.stretchX = (int)(16*(float)court_zoom);
4210:                                         psis.stretchY = (int)(32*(float)court_zoom);
4211: 
4212:                                         spr_draw(temp_psis, px+32+pie_attacks[i][2]*cos(pie_attacks[i][1]*3.14/180), py+48+pie_attacks[i][2]*sin(pie_attacks[i][1]*3.14/180));
4213:                                         spr_draw(temp_psis, px+32+pie_attacks[i][2]*cos((pie_attacks[i][1]+180)*3.14/180), py+48+pie_attacks[i][2]*sin((pie_attacks[i][1]+180)*3.14/180));
4214: 
4215:                                         pie_attacks[i][1] += 16;
4216: 
4217:                                         if (pie_attacks[i][1] > 360)
4218:                                         {
4219:                                             pie_attacks[i][1] = pie_attacks[i][1]%360;
4220:                                             pie_attacks[i][2]-=2;
4221:                                         }
4222:                                     }
4223:                                     else if (pie_attacks[i][2] <= 0)
4224:                                     {
4225:                                             explode.stretchX = explode.stretchY = 40 + 4*pie_attacks[i][2];
4226:                                             spr_draw(explode, px, py);
4227: 
4228:                                             if (!(pie_attacks[i][2])) oslPlaySound(expl_sound);
4229: 
4230:                                             if ((!shielded) && (counter%2))
4231:                                             {
4232:                                                 health -= diff;
4233:                                                 if (putin) health -= diff;
4234:                                                 oslPlaySound(benj_sfx[random(5)]);
4235:                                             }
4236:                                             pie_attacks[i][2]--;
4237: 
4238:                                             if (pie_attacks[i][2] == -10)
4239:                                             {
4240:                                                 oslStopSound(psis_sfx);
4241:                                                 pie_attacks[i][0]=0;
4242:                                             }
4243:                                     }
4244:                                 }
4245:                                 break;
4246:                             }
4247: 
4248:                             case 7:
4249:                             {
4250:                                 if ((mgcd < 1) && (health > 0) && (!lightsoff))
4251:                                 {
4252:                                     if (!(pie_attacks[i][1]))
4253:                                     {
4254:                                         temp_recipe=oslSetImageTileSize(recipe,0, 0, 32, 136);
4255:                                     }
4256:                                     else
4257:                                     {
4258:                                         temp_recipe=oslSetImageTileSize(recipe, 32, 0, 32, 136);
4259:                                     }
4260:                                     temp_recipe.trans=128;
4261: 
4262:                                     if (pie_attacks[i][2] > 0)
4263:                                     {
4264:                                         oslDrawFillRect(pie_attacks[i][4], 0, (pie_attacks[i][1])?480:0, 272, _RGBA(0, 0, 0, 128));
4265: 
4266:                                         for(u=0; u<4; u++)
4267:                                         {
4268:                                             spr_draw(temp_recipe, pie_attacks[i][4]+((pie_attacks[i][1])?0:32), u*136-(global_fr%137));
4269:                                         }
4270: 
4271:                                         //oslSetAlpha(OSL_FX_DEFAULT, 0);
4272: 
4273:                                         if (((pie_attacks[i][1]) && (pie_attacks[i][2] <= (480-pie_attacks[i][3]))) ||
4274:                                                 ((!(pie_attacks[i][1])) && (pie_attacks[i][2] <= pie_attacks[i][3])))
4275:                                         {
4276: 
4277: 
4278:                                             if (((pie_attacks[i][1]) && (px+32 >= pie_attacks[i][4])) || (!(pie_attacks[i][1]) && (px+32 <= pie_attacks[i][4])))
4279:                                             {
4280:                                                 if (!al_get_sample_instance_position(mouth_sfx[0].instance)) oslPlaySound(mouth_sfx[0]);
4281:                                                 oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
4282:                                                 spr_draw(mouth, 240, 136);
4283: 
4284:                                                 pie_attacks[i][2]++;
4285:                                                 mouth.stretchX += 6;
4286:                                                 mouth.stretchY = 1.63*mouth.stretchX;
4287: 
4288:                                                 if (mouth . stretchY >= 420)
4289:                                                 {
4290:                                                     if (!al_get_sample_instance_position(mouth_sfx[1].instance)) oslPlaySound(mouth_sfx[1]);
4291:                                                     oslDrawFillRect(0, 0, 480, 272, _RGB(255, 0, 0));
4292:                                                 }
4293: 
4294:                                                 if (mouth . stretchY >= 450)
4295:                                                 {
4296:                                                     health -= 2*diff+4;
4297:                                                     if (putin) health -= 2;
4298:                                                     pie_attacks[i][0]=0;
4299:                                                     mouth . stretchX = 10;
4300:                                                     mouth . stretchY = 16;
4301:                                                 }
4302: 
4303:                                             }
4304:                                         else
4305:                                             {
4306:                                                 if (!(pie_attacks[i][1]))
4307:                                                 {
4308:                                                     pie_attacks[i][4]--;
4309: 
4310:                                                 }
4311:                                                 else
4312:                                                 {
4313:                                                     pie_attacks[i][4]++;
4314: 
4315:                                                 }
4316:                                             }
4317:                                         }
4318:                                         else
4319:                                         {
4320:                                             if (!(pie_attacks[i][1]))
4321:                                             {
4322:                                                 if (pie_attacks[i][4] < pie_attacks[i][3]) pie_attacks[i][4]++;
4323:                                                 if (pie_attacks[i][4] > 512)
4324:                                                 {
4325:                                                     darkness=0;
4326:                                                     pie_attacks[i][0]=0;
4327:                                                 }
4328:                                             }
4329:                                             else
4330:                                             {
4331:                                                 if (pie_attacks[i][4] > pie_attacks[i][3]) pie_attacks[i][4]--;
4332:                                                 if (pie_attacks[i][4] < -64)
4333:                                                 {
4334:                                                     darkness=0;
4335:                                                     pie_attacks[i][0]=0;
4336:                                                 }
4337:                                             }
4338:                                         }
4339:                                         pie_attacks[i][2]--;
4340: 
4341: 
4342:                                     }
4343:                                     else
4344:                                     {
4345:                                         darkness=0;
4346:                                         pie_attacks[i][0]=0;
4347:                                     }
4348: 
4349:                                     if (pie_attacks[i][2] <= 0)
4350:                                     {
4351:                                         pie_attacks[i][0]=0;
4352:                                     }
4353:                                 }
4354:                                 break;
4355:                             }
4356: 
4357: 
4358:                             }
4359:                         }
4360:                     }
4361:                 }
4362: 
4363:                 if ((!al_get_sample_instance_position(minigametime.instance)) && (!al_get_sample_instance_position(tvnoisesound.instance)) && (!paused))
4364:                     {
4365:                         tvnoise_ev=random((3800/(100*round*diff))*pie_ent.pie_hp+4200);
4366:                     }
4367: 
4368:                 if ((tvnoise_ev <= 4000) && (tvnoise_ev > 3940) && (round==2)  && (health>0) && (!lightsoff) && (!paused))
4369:                 {
4370:                     i=random(20);
4371:                     spr_draw(tvnoise[i], 0, 0);
4372:                     if (!al_get_sample_instance_position(tvnoisesound.instance)) oslPlaySound(tvnoisesound);
4373:                     tvnoise_ev--;
4374:                 }
4375:                 else
4376:                 {
4377:                     oslStopSound(tvnoisesound);
4378:                 }
4379:             }
4380: 
4381:             if ((pie_ent.pie_hp) && (!mgcd))
4382:             {
4383:                 reddv = (-0.64/(round*diff))*pie_ent.pie_hp+64;
4384: 
4385:                 oslDrawFillRect(0, 0, 480, 272, _RGBA(255, 0, 0, (int)(reddv*1.5)));
4386:             }
4387: 
4388: 
4389: 
4390:             if ((health < 1) || (pie_ent.pie_hp < 1))
4391:             {
4392:                 oslStopSound(psis_sfx);
4393:                 ball_ent.speed_v=0;
4394:                 if (pie_ent.pie_hp < 1)
4395:                 {
4396:                     if (!ko_frame)
4397:                     {
4398:                         a=pie_ent.pie_x-128+random(256);
4399: 
4400:                         for (i=0; i<8; i++)
4401:                             {
4402:                                 for (j=0; j<5; j++)
4403:                                 {
4404:                                     pie_attacks[i][j]=0;
4405:                                 }
4406:                                 bulbfell=0;
4407:                             }
4408:                     }
4409: 
4410:                     mort=1;
4411: 
4412: 
4413:                     if (round==2)
4414:                     {
4415:                         if (!(ko_frame%9))
4416:                         {
4417:                             oslPlaySound(expl_sound);
4418:                             kx=pie_ent.pie_x-128+random(256);
4419:                             ky=random(136);
4420:                         }
4421: 
4422:                         if ((ko_frame%6) < 3)
4423:                         {
4424:                             explode.stretchX = 64;
4425:                             explode.stretchY = 96;
4426:                             spr_draw(explode, kx, ky);
4427:                         }
4428:                         else
4429:                         {
4430:                             explode.stretchX = 32;
4431:                             explode.stretchY = 48;
4432:                             spr_draw(explode, kx+16, ky+24);
4433:                         }
4434:                     }
4435:                 }
4436: 
4437:                 if (ko_frame == 0)
4438:                 {
4439:                     oslPlaySound(ko_sfx);
4440:                     oslPlaySound(expl_sound);
4441:                     u=0;
4442:                 }
4443: 
4444:                 if (health < 1)
4445:                 {
4446:                     if (ko_frame < 60)
4447:                     {
4448:                         if ((ko_frame%6) < 3)
4449:                         {
4450:                             explode.stretchX = 64;
4451:                             explode.stretchY = 96;
4452:                             spr_draw(explode, px, py);
4453:                         }
4454:                         else
4455:                         {
4456:                             explode.stretchX = 32;
4457:                             explode.stretchY = 48;
4458:                             spr_draw(explode, px+16, py+24);
4459:                         }
4460:                     }
4461:                 }
4462: 
4463: 
4464:                 if (ko_frame < 25)
4465:                 {
4466:                     temp_ko=oslSetImageTileSize(ko,0,0,120,96);
4467:                     spr_draw(temp_ko, (int)(9.6*ko_frame-120), 88);
4468:                 }
4469: 
4470:                 if ((ko_frame >= 25) && (ko_frame <= 50))
4471:                 {
4472:                     temp_ko=oslSetImageTileSize(ko,0,0,120,96);
4473:                     spr_draw(temp_ko, 120, 88);
4474:                     temp_ko=oslSetImageTileSize(ko,120,0,120,96);
4475:                     spr_draw(temp_ko, (int)(-9.6*ko_frame+720), 88);
4476:                 }
4477: 
4478:                 if (ko_frame > 50)
4479:                 {
4480:                     temp_ko=oslSetImageTileSize(ko,0,0,240,96);
4481:                     spr_draw(temp_ko, 120, 88);
4482:                 }
4483: 
4484:                 if (ko_frame >= 140) quit=1;
4485: 
4486: 
4487:                 ko_frame++;
4488:             }
4489: 
4490:             if (health < 0) health=0;
4491: 
4492:             if (!mgcd)
4493:             {
4494:                     temp_no=oslSetImageTileSize(numberz,160,0,16,16);
4495:                     spr_draw(temp_no, 2, 2);
4496: 
4497:                     u=random(5);
4498: 
4499:                     temp_ultg=oslSetImageTileSize(ultgauge,0,0,64,8);
4500:                     spr_draw(temp_ultg, 2+((round==2)?u:0), (round==2)?20+u:21);
4501:                     temp_ultg=oslSetImageTileSize(ultgauge,(int)((ultlvl/60)*6),9,6,6);
4502:                     spr_draw(temp_ultg, 69+((round==2)?u:0), (round==2)?21+u:22);
4503:                     spr_draw(shlgauge, 2+((round==2)?u:0), (round==2)?28+u:30);
4504: 
4505:                     if (ultlvl > 1) oslDrawFillRect(4+((round==2)?u:0), (round==2)?22+u:23, ultlvl%60+4+((round==2)?u:0), (round==2)?25+u:26, _RGB(0,0,255));
4506:                     if (shldlvl > 1) oslDrawFillRect(4+((round==2)?u:0), (round==2)?31+u:32, shldlvl+4+((round==2)?u:0), (round==2)?34+u:35, _RGB(255,150,255));
4507: 
4508:                     if ((ultlvl%60) > 15)
4509:                     {
4510:                         if ((ultrectshine+16) <= ultlvl%60)
4511:                         {
4512:                             oslDrawFillRect(ultrectshine+((round==2)?u:0), (round==2)?22+u:23, ultrectshine+13+((round==2)?u:0), (round==2)?25+u:26, _RGB(0,255,255));
4513:                         }
4514:                         else
4515:                         {
4516:                             oslDrawFillRect(ultrectshine+((round==2)?u:0), (round==2)?22+u:23, ultlvl%60+3+((round==2)?u:0), (round==2)?25+u:26, _RGB(0,255,255));
4517:                         }
4518: 
4519:                         if ((ultrectshine+8) <= ultlvl%60)
4520:                         {
4521:                             oslDrawFillRect(ultrectshine+4+((round==2)?u:0), (round==2)?22+u:23, ultrectshine+9+((round==2)?u:0), (round==2)?25+u:26, _RGB(255,255,255));
4522:                         }
4523:                         else
4524:                         {
4525:                             oslDrawFillRect(ultrectshine+4+((round==2)?u:0), (round==2)?22+u:23, ultlvl%60+3+((round==2)?u:0), (round==2)?25+u:26, _RGB(255,255,255));
4526:                         }
4527: 
4528:                         ultrectshine++;
4529: 
4530:                         if (ultrectshine > ultlvl%60)
4531:                         {
4532:                             ultrectshine=0;
4533:                         }
4534:                     }
4535: 
4536:                     i=random(15);
4537: 
4538:                     u=18;
4539: 
4540:                     if (health < 25) j=16; else j=0;
4541: 
4542:                         if (health / 100)
4543:                         {
4544:                             temp_no=oslSetImageTileSize(numberz,((round==2)?((i<12)?16:random(144)):16),0,16,16);
4545:                             spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
4546:                             u += 16;
4547:                         }
4548: 
4549:                         if (health > 9)
4550:                         {
4551:                             if (round==2)
4552:                                 {
4553:                                     if (i<12)
4554:                                         {
4555:                                             temp_no=oslSetImageTileSize(numberz,((health%100)/10)*16,j,16,16);
4556:                                         }
4557:                                     else
4558:                                         {
4559:                                             temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
4560:                                         }
4561:                                 }
4562:                             else temp_no=oslSetImageTileSize(numberz,((health%100)/10)*16,j,16,16);
4563:                         spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
4564:                         u += 16;
4565:                         }
4566: 
4567:                         if (round==2)
4568:                             {
4569:                                 if (i<12)
4570:                                     {
4571:                                         temp_no=oslSetImageTileSize(numberz,(health%10)*16,j,16,16);
4572:                                     }
4573:                                 else
4574:                                     {
4575:                                         temp_no=oslSetImageTileSize(numberz,random(128),j,16,16);
4576:                                     }
4577:                             }
4578:                         else temp_no=oslSetImageTileSize(numberz,(health%10)*16,j,16,16);
4579:                         spr_draw(temp_no, u + ((round==2)?random(3):0), ((round==2)?1+random(3):2));
4580:                 }
4581: 
4582: 
4583: 
4584:             if ((paused) && (health))
4585:             {
4586:                 oslDrawFillRect(0,0,480,272, _RGBA(0,8,0,224));
4587:                 spr_draw(paused_gfx, 240, 136);
4588:             }
4589: 
4590:             if ((!(counter%6)) && (shldlvl<60) && (!shielded) && (!paused)) shldlvl++;
4591: 
4592: 
4593:             if (counter < 256)
4594:             {
4595:                 if (counter < 128)
4596:                 {
4597:                     temp_prem=oslSetImageTileSize(premess,0,0,256,64);
4598: 
4599:                     if (counter < 32) temp_prem.stretchY = counter*2;
4600:                     else if (counter > 96) temp_prem.stretchY = 128-counter*2;
4601:                     else temp_prem.stretchY = 64;
4602: 
4603:                     spr_draw(temp_prem, 112, 136-(premess.stretchY)/2);
4604:                 }
4605: 
4606:                 else if (counter >= 128)
4607:                 {
4608:                     temp_prem=oslSetImageTileSize(premess,0,64,256,64);
4609:                     if (counter < 160) temp_prem.stretchY = (counter-128)*2;
4610:                     else if (counter > 224) temp_prem.stretchY = 256-counter*2;
4611:                     else temp_prem.stretchY = 64;
4612: 
4613:                     spr_draw(temp_prem, 112, 136-(premess.stretchY)/2);
4614:                 }
4615: 
4616:                 // if (counter==255) oslDeleteImage(premess);
4617:             }
4618: 
4619: 
4620: 
4621:             /*if ((nbp==1) && (DEBUG))
4622:             {
4623:                 if (osl_keys.held.R)
4624:                 {
4625:                     for (i=0; i<16; i++)
4626:                     {
4627:                         sprintf(buffer,"%d",(i<15)?att_cooldowns[i]:(int)reddv);
4628:                         u = oslGetStringWidth(buffer);
4629: 
4630:                         oslSetTransparentColor(RGB(255,0,255));
4631:                         oslSetBkColor(RGB(255,0,255));
4632:                         oslSetTextColor(RGB(255, 255, 255));
4633:                         oslDrawString(480-u, i*12, buffer);
4634:                     }
4635:                 }
4636: 
4637: 
4638:                 if (osl_keys.held.L)
4639:                 {
4640:                     for (i=0; i<10; i++)
4641:                     {
4642:                         sprintf(buffer,"%d", (i<8)?pie_attacks[i][0]:
4643:                                                         (i==8)?(pie_ent.pie_hp):
4644:                                                                 (int)(-2.55/(round*diff)*(pie_ent.pie_hp)+255));
4645:                         u = oslGetStringWidth(buffer);
4646: 
4647:                         oslSetTransparentColor(RGB(255,0,255));
4648:                         oslSetBkColor(RGB(255,0,255));
4649:                         oslSetTextColor(RGB(255, 255, 255));
4650:                         oslDrawString(480-u, i*12, buffer);
4651:                     }
4652:                 }
4653:             }*/
4654: 
4655:             if ((att_ch_timer < 80) && (nbp==2) && (health > 0) && (pie_ent.pie_hp > 0) && (!paused))
4656:             {
4657:                 spr_draw(attch, 32, 33);
4658:                 spr_draw(cp2, 40 + cursor2p*32, 68);
4659:                 for (i=0; i<15; i++)
4660:                 {
4661:                     if (att_cooldowns[i] > 1)
4662:                     {
4663:                         sprintf(buffer, "%d", att_cooldowns[i]/60);
4664: 
4665:                         oslDrawFillRect(32+i*32, 33, 32+(i+1)*32, 67, _RGBA(1, 1, 1, 128));
4666: 
4667:                         if (i < 12) oslDrawString(36+i*32, 42, buffer);
4668:                         if ((i==12) && (pie_ent.pie_hp > 25*round*diff) && (ulted == 0) && (att_cooldowns[12] > 1))
4669:                         {
4670:                             al_draw_line(32+i*32, 33, 32+(i+1)*32, 66, _RGB(255, 0, 0), 0);
4671:                         }
4672:                         if ((i==13) && (pie_ent.pie_hp > 10*round*diff) && (ulted != 1) && (att_cooldowns[13] > 1))
4673:                         {
4674:                             al_draw_line(32+i*32, 33, 32+(i+1)*32, 66, _RGB(255, 0, 0), 0);
4675:                         }
4676:                     }
4677:                 }
4678:             }
4679: 
4680:             if (nbp == 2)
4681:             {
4682:                 oslSetTextColor( _RGBA(255, 255, 255, 255-(global_fr%64)*4));
4683:                 oslDrawString(270, 2, "OTHER MORTAL, USE I OR O TO ATTACK!");
4684:                 oslSetTextColor( _RGB(255, 255, 255));
4685:             }
4686: 
4687:         oslEndDrawing();
4688:         oslSwapBuffers();
4689:         }
4690:        
4691:         //oslWaitVSync();
4692: 
4693:         /*oslSwapBuffers();
4694:         oslWaitVSync();*/
4695: 
4696:         if (mgcd==100)
4697:             {
4698:                 u=random(6);
4699: 
4700:                 switch(u)
4701:                 {
4702:                     case 0:
4703:                     i=sonicexe(diff);
4704:                     break;
4705: 
4706:                     case 1:
4707:                     i=mincer(diff);
4708:                     break;
4709: 
4710:                     case 2:
4711:                     i=shoot_teevees(diff, &health, round);
4712:                     break;
4713: 
4714:                     case 3:
4715:                     i=flappy_cacodemon(diff);
4716:                     break;
4717: 
4718:                     case 4:
4719:                     i=love_boat(diff);
4720:                     break;
4721: 
4722:                     case 5:
4723:                     i=sonicexe2(diff);
4724:                     break;
4725:                 }
4726:                 if (i)
4727:                     {
4728:                      oslPlaySound(giygas[giyg_flag%3]);
4729: 
4730:                     } else health=0;
4731: 
4732: 
4733:                 for (i=0; i<8; i++)
4734:                     {
4735:                         for (j=0; j<5; j++)
4736:                         {
4737:                             pie_attacks[i][j]=0;
4738:                         }
4739:                         bulbfell=0;
4740:                     }
4741: 
4742:                 pie_ent.pie_facemode=0;
4743:                 mgcd=0;
4744:                 mouth.stretchX = 10;
4745:                 if (diff != 3) a=diff; else a=2;
4746:                 ball_ent = apply_impulse(ball_ent, random(2)?a:-1*a, random(2)?a:-1*a, (180-15*frappe)*3.14/180);
4747:                 frappe=-1;
4748:                 rckchscr=0;
4749:                 if (putin) putin=0;
4750:             }
4751:     }
4752: 
4753: 
4754:     if ((mort==1) && (round==2))
4755:     {
4756:         oslStopSound(tvnoisesound);
4757:         oslDeleteSound(paf);
4758:         paf = oslLoadSoundFile("./sfx/sfx-0029.wav");
4759: 
4760:         oslStopSound(giygas[2]);
4761: 
4762:         oslPlaySound(tvnoisesound);
4763: 
4764: 
4765:         for(i=0; i<420; i++)
4766:         {
4767:             oslStartDrawing();
4768:             oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
4769:                 u=random(4);
4770:                 //oslSetBilinearFilter(1);
4771:                 spr_draw(tvnoise[u], 0, 0);
4772:                 spr_draw(tvnoise[u], random(480), random(272));
4773:                 spr_draw(tvnoise[u], random(480)-240, random(272)-136);
4774:                 spr_draw(tvnoise[u], random(240)-120, random(136)-68);
4775:                 //oslSetBilinearFilter(0);
4776:             oslEndDrawing();
4777:             oslWaitVSync();
4778:             oslSwapBuffers();
4779:         }
4780: 
4781:         oslStopSound(tvnoisesound);
4782:         oslPlaySound(paf);
4783: 
4784:         for(i=0; i<=135; i+=2)
4785:         {
4786:             oslStartDrawing();
4787:             oslDrawFillRect(0, 0, 480, 272, _RGB(0, 0, 0));
4788:             oslDrawFillRect(0, i, 480, 272-i, _RGB(255, 255, 255));
4789:             oslEndDrawing();
4790:             oslWaitVSync();
4791:             oslSwapBuffers();
4792:         }
4793: 
4794:         fadeout();
4795:     }
4796: 
4797: 
4798:     for (i=0; i<3; i++) oslDeleteSound(giygas[i]);
4799: 
4800:     for (i=0; i<4; i++) oslDeleteSound(dictators_sfx[i]);
4801: 
4802:     for (i=0; i<5; i++) oslDeleteImage(tvnoise[i]);
4803: 
4804:     for (i=0; i<7; i++) oslDeleteSound(bulbsfx[i]);
4805: 
4806:     for (i=0; i<11; i++) oslDeleteSound(benj_sfx[i]);
4807: 
4808:     oslDeleteSound(tvnoisesound);
4809:    
4810:     if (round==2)
4811:     {
4812:         for (i=0; i<33; i++) oslDeleteImage(giyg_bg[i]);
4813:     }
4814: 
4815:     oslDeleteSound(ko_sfx);
4816:     oslDeleteSound(quitter);
4817:     oslDeleteSound(pew);
4818:     oslDeleteSound(paf);
4819:     oslDeleteSound(psis_sfx);
4820:     oslDeleteImage(numberz);
4821:     oslDeleteImage(starsky);
4822:     oslDeleteImage(lightning);
4823:     oslDeleteImage(pie);
4824:     oslDeleteImage(sleepwell);
4825:     oslDeleteImage(ko);
4826:     oslDeleteImage(explode);
4827:     oslDeleteImage(ball_gfx);
4828:     oslDeleteImage(ball_shad);
4829:     oslDeleteImage(mgswirl);
4830:     oslDeleteImage(powerball);
4831:     oslDeleteSound(minigametime);
4832:     oslDeleteSound(expl_sound);
4833:     oslDeleteSound(expl_sound2);
4834:     oslDeleteSound(meteor_fall);
4835:     oslDeleteSound(stun_sound);
4836:     oslDeleteSound(elec);
4837:     oslDeleteSound(thunder);
4838:     oslDeleteSound(whine);
4839:     oslDeleteSound(mouth_sfx[0]);
4840:     oslDeleteSound(mouth_sfx[1]);
4841:     oslDeleteSound(bounce);
4842:     oslDeleteImage(rckch[0]);
4843:     oslDeleteImage(rckch[1]);
4844:     oslDeleteImage(psycho);
4845:     oslDeleteImage(paused_gfx);
4846:     oslDeleteImage(ultgauge);
4847:     oslDeleteImage(shlgauge);
4848:     oslDeleteImage(visor);
4849:     oslDeleteImage(bulbasaur);
4850:     oslDeleteImage(recipe);
4851:     oslDeleteImage(shield);
4852:     oslDeleteImage(meteor);
4853:     oslDeleteImage(stunning);
4854:     oslDeleteImage(juche);
4855:     oslDeleteImage(psis);
4856:     oslDeleteImage(dictators);
4857:     oslDeleteImage(mouth);
4858:     oslDeleteImage(star);
4859:     oslDeleteImage(suppo_gfx);
4860:     oslDeleteImage(ulting_gfx);
4861:     oslDeleteImage(attch);
4862:     oslDeleteImage(cp2);
4863: 
4864:     return mort;
4865: }
4866: 
4867: void taunt(int nbt)
4868: {
4869:     int frame=0, k;
4870:     const char *texts[12] = {"YOUR HEAD IS ALREADY OFF", "YOU WON'T SEE THE MOCK TURTLE", "MOTHER", "YOU'RE NOT EVEN TRYING", "AEIOU", "UNHAPPY UNBIRTHDAY", "YOU'RE LATE YOU'RE LATE YOU'RE LATE",
4871:                              "NO TIME TO SAY GOODBYE", "PAINTING YOUR BOWELS RED", "HOW DOTH THE LITTLE OF YOU LIVE", "I HAVE A VERY GOOD ADVICE", "THE WALRUS ATE THE CARPENTER"};
4872: 
4873:     OSL_SOUND wind = oslLoadSoundFile("./sfx/sfx-0019.wav");
4874: 
4875:     k = oslGetStringWidth(texts[nbt]);
4876: 
4877:     oslPlaySound(wind);
4878: 
4879:     while(frame<282)
4880:     {
4881:         oslStartDrawing();
4882:         oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
4883: 
4884: 
4885:         if (frame < 82)
4886:         {
4887:             oslSetTextColor(_RGB(frame*3, frame*3, frame*3));
4888:             oslDrawString((480 - k)/2, 130, texts[nbt]);
4889:         }
4890:         if ((frame >= 82) && (frame <= 200))
4891:         {
4892:             oslSetTextColor(_RGB(255, 255, 255));
4893:             oslDrawString((480 - k)/2, 130, texts[nbt]);
4894:         }
4895:         else if (frame > 200)
4896:         {
4897:             oslSetTextColor(_RGB((282-frame)*3, (282-frame)*3, (282-frame)*3));
4898:             oslDrawString((480 - k)/2, 130, texts[nbt]);
4899:         }
4900:         oslEndDrawing();
4901:         oslSwapBuffers();
4902:         oslWaitVSync();
4903:         frame++;
4904:     }
4905: 
4906:     oslDeleteSound(wind);
4907: }
4908: 
4909: void creepypasta(int cpn)
4910: {
4911:     int i, j, k, l, frame=0;
4912:     char buffer[20];
4913:     OSL_IMAGE suicidemouse[18];
4914:     OSL_IMAGE temp_gfx;
4915:     OSL_SOUND creepysfx, sfx;
4916:     int bok[4][16];
4917:     const char *text[7]={"y wud u do dis","acually is dolan","fak u","FAGGT","u litl SHIZNIT", "gooby pls", "i wuz ins al a long"};
4918: 
4919:     switch(cpn)
4920:     {
4921: 
4922:     case 0:
4923: 
4924:         for (i=0; i<18; i++)
4925:         {
4926:             sprintf(buffer,"./gfx/gfx-%d.png",i+1160);
4927:             suicidemouse[i]=LoadImg(buffer);
4928: 
4929:             suicidemouse[i].stretchX = 363;
4930:             suicidemouse[i].stretchY = 272;
4931:             suicidemouse[i]=oslSetImageRotCenter(suicidemouse[i]);
4932:         }
4933: 
4934:         creepysfx = oslLoadSoundFile("./sfx/sfx-0065.wav");
4935:         oslSetSoundLoop(creepysfx, 1);
4936:         oslPlaySound(creepysfx);
4937: 
4938:         i=0;
4939: 
4940: 
4941: 
4942:         while (frame < 620)
4943:         {
4944:             if (!(frame%6)) i++;
4945:             oslStartDrawing();
4946:             oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
4947:             spr_draw(suicidemouse[i%18],240,138);
4948:             oslEndDrawing();
4949:             oslSwapBuffers();
4950: 
4951:             oslWaitVSync();
4952:             frame++;
4953:         }
4954: 
4955:         for (i=0; i<18; i++)
4956:         {
4957:              oslDeleteImage(suicidemouse[i]);
4958:         }
4959: 
4960:         oslStopSound(creepysfx);
4961:         oslDeleteSound(creepysfx);
4962:        
4963:         break;
4964: 
4965: 
4966: 
4967:     case 1:
4968:         suicidemouse[0]=LoadImg("./gfx/gfx-1038.png");
4969:         suicidemouse[1]=LoadImg("./gfx/gfx-1039.png");
4970: 
4971:         suicidemouse[0]=oslSetImageRotCenter(suicidemouse[0]);
4972: 
4973:         creepysfx = oslLoadSoundFile("./sfx/sfx-0058.wav");
4974: 
4975:         oslSetSoundLoop(creepysfx, 0);
4976:         oslPlaySound(creepysfx);
4977: 
4978:         while (frame < 45)
4979:         {
4980:             oslStartDrawing();
4981:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
4982:             suicidemouse[0]=oslSetAlpha(suicidemouse[0], frame*4);
4983:             spr_draw(suicidemouse[0],240,271);
4984:             oslEndDrawing();
4985:             //frame_debug(frame);
4986:             oslSwapBuffers();
4987: 
4988:             suicidemouse[0].stretchX +=2;
4989:             suicidemouse[0].stretchY +=2;
4990: 
4991:             oslSetImageRotCenter(suicidemouse[0]);
4992:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
4993:             frame++;
4994:             oslWaitVSync();
4995:         }
4996: 
4997:         for (i=0; i<4; i++)
4998:         {
4999:             oslStartDrawing();
5000:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
5001:             oslEndDrawing();
5002:             oslSwapBuffers();
5003:             oslWaitVSync();
5004:         }
5005:        
5006:         for (i=0; i<4; i++)
5007:         {
5008:             oslStartDrawing();
5009:             oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
5010:             spr_draw(suicidemouse[1],0,0);
5011:             oslEndDrawing();
5012:             oslSwapBuffers();
5013:         }
5014:         fadeout();
5015:         oslDeleteImage(suicidemouse[0]);
5016:         oslDeleteImage(suicidemouse[1]);
5017: 
5018:         /*while (oslGetSoundChannel(creepysfx) == 0);*/
5019: 
5020:         oslDeleteSound(creepysfx);
5021:     break;
5022: 
5023:     case 2:
5024: 
5025:         j = random(2);
5026: 
5027:         if (!j) suicidemouse[0] = LoadImg("./gfx/endisneigh.png");
5028:         else suicidemouse[0] = LoadImg("./gfx/endisneigh2.png");
5029: 
5030:         if (!j) creepysfx = oslLoadSoundFile("./sfx/sfx-0083.wav");
5031:         else creepysfx = oslLoadSoundFile("./sfx/sfx-0109.wav");
5032: 
5033:         oslSetSoundLoop(creepysfx, 0);
5034:         oslPlaySound(creepysfx);
5035: 
5036:         for (i=0; i<10; i++)
5037:         {
5038:             oslStartDrawing();
5039:             spr_draw(suicidemouse[0],0,0);
5040:             oslEndDrawing();
5041:             oslSwapBuffers();
5042:             oslWaitVSync();
5043:         }
5044:         fadeout();
5045:         oslDeleteImage(suicidemouse[0]);
5046:         break;
5047: 
5048: 
5049:     case 3:
5050:         suicidemouse[0] = LoadImg("./gfx/safe.png");
5051:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5052:         creepysfx = oslLoadSoundFile("./sfx/sfx-0026.wav");
5053: 
5054:         oslSetSoundLoop(creepysfx, 0);
5055:         oslPlaySound(creepysfx);
5056: 
5057:         for (i=0; i<3; i++)
5058:         {
5059:             oslStartDrawing();
5060:             oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
5061:             oslEndDrawing();
5062:             oslSwapBuffers();
5063:             oslWaitVSync();
5064:         }
5065: 
5066:         for (i=0; i<200; i++)
5067:             {
5068:             oslStartDrawing();
5069:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5070:             spr_draw(suicidemouse[0],239,135);
5071:             oslEndDrawing();
5072:             oslSwapBuffers();
5073:             oslWaitVSync();
5074:             }
5075: 
5076:         fadeout();
5077:         oslDeleteImage(suicidemouse[0]);
5078:         oslDeleteSound(creepysfx);
5079:         break;
5080: 
5081:     case 4:
5082:         for (i=0; i<4; i++)
5083:         {
5084:             sprintf(buffer,"./gfx/bnours%d.png",i+1);
5085:             suicidemouse[i]=LoadImg(buffer);
5086:         }
5087:         creepysfx = oslLoadSoundFile("./sfx/sfx-0149.wav");
5088: 
5089:         oslSetSoundLoop(creepysfx, 0);
5090:         oslPlaySound(creepysfx);
5091: 
5092:         i=0;
5093: 
5094:         while (frame < 600)
5095:                 {
5096:                     if (!(frame%4)) i++;
5097:                     oslStartDrawing();
5098:                     spr_draw(suicidemouse[i%4],0,0);
5099:                     oslEndDrawing();
5100:                     oslSwapBuffers();
5101:                     frame++;
5102:                     oslWaitVSync();
5103:                 }
5104: 
5105:                 fadeout();
5106: 
5107:         for (i=0; i<4; i++)
5108:         {
5109:              oslDeleteImage(suicidemouse[i]);
5110:         }
5111:         oslDeleteSound(creepysfx);
5112:         break;
5113: 
5114:     case 5:
5115:         suicidemouse[0] = LoadImg("./gfx/court_joy.png");
5116:         suicidemouse[1] = LoadImg("./gfx/gfx-0717.png");
5117:         creepysfx = oslLoadSoundFile("./sfx/sfx-0147.wav");
5118:         sfx=oslLoadSoundFile("./sfx/sfx-0011.wav");
5119: 
5120:         oslPlaySound(sfx);
5121: 
5122:         for (j=0; j<256; j+=3)
5123:         {
5124:             oslStartDrawing();
5125:             oslDrawFillRect(0,0,480,272, _RGB(255,255,255));
5126: 
5127:             suicidemouse[0]=oslSetAlpha(suicidemouse[0], j);
5128:             suicidemouse[1]=oslSetAlpha(suicidemouse[1], j);
5129:             spr_draw(suicidemouse[0],0,0);
5130:             spr_draw(suicidemouse[1],177,215);
5131: 
5132:             oslEndDrawing();
5133:             oslSwapBuffers();
5134:             oslWaitVSync();
5135:         }
5136: 
5137:         /*oslSetAlpha(OSL_FX_DEFAULT,0);*/
5138: 
5139:         oslSetSoundLoop(creepysfx, 0);
5140:         oslPlaySound(creepysfx);
5141: 
5142:         while (frame < 292)
5143:         {
5144:             oslStartDrawing();
5145:             spr_draw(suicidemouse[0],0,0);
5146:             spr_draw(suicidemouse[1],177,215);
5147:             oslEndDrawing();
5148: 
5149:             oslSwapBuffers();
5150: 
5151:             frame++;
5152:             oslWaitVSync();
5153:         }
5154: 
5155:         fadeout();
5156:         oslDeleteImage(suicidemouse[0]);
5157:         oslDeleteImage(suicidemouse[1]);
5158:         oslDeleteSound(creepysfx);
5159:         oslDeleteSound(sfx);
5160:         break;
5161: 
5162:     case 6:
5163:         creepysfx = oslLoadSoundFile("./sfx/sfx-0060.wav");
5164:         suicidemouse[0] = LoadImg("./gfx/oag1.png");
5165:         suicidemouse[1] = LoadImg("./gfx/oag2.png");
5166: 
5167:         oslStartDrawing();
5168:         spr_draw(suicidemouse[0],0,0);
5169:         oslEndDrawing();
5170: 
5171:         oslSwapBuffers();
5172: 
5173:         while (frame < 720)
5174:         {
5175:             if (frame==480)
5176:             {
5177:                 oslSetSoundLoop(creepysfx, 0);
5178:                 oslPlaySound(creepysfx);
5179:             }
5180: 
5181:             if (frame >= 480)
5182:             {
5183: 
5184:                 oslStartDrawing();
5185:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5186:                 spr_draw(suicidemouse[1],173,26);
5187:                 oslEndDrawing();
5188:                 oslSwapBuffers();
5189: 
5190:             }
5191:             else if (frame < 480)
5192:             {
5193:                 oslStartDrawing();
5194:                 spr_draw(suicidemouse[0],0,0);
5195:                 oslEndDrawing();
5196:                 oslSwapBuffers();
5197:             }
5198: 
5199: 
5200:             frame++;
5201:             oslWaitVSync();
5202:         }
5203: 
5204:         fadeout();
5205:         oslDeleteImage(suicidemouse[0]);
5206:         oslDeleteImage(suicidemouse[1]);
5207:         oslDeleteSound(creepysfx);
5208:         break;
5209: 
5210:     case 7:
5211:         creepysfx = oslLoadSoundFile("./sfx/sfx-0148.wav");
5212:         suicidemouse[0] = LoadImg("./gfx/smurf_village.png");
5213:         suicidemouse[1] = LoadImg("./gfx/smurf_sprite.png");
5214:         suicidemouse[2] = LoadImg("./gfx/smurf_papazombie.png");
5215: 
5216:         oslStartDrawing();
5217:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5218:         spr_draw(suicidemouse[0],0,0);
5219:         oslEndDrawing();
5220: 
5221:         i=0;
5222:         j=-32;
5223:         frame=0;
5224: 
5225:         oslSetSoundLoop(creepysfx, 0);
5226:         oslPlaySound(creepysfx);
5227:         suicidemouse[2]=oslSetImageRotCenter(suicidemouse[2]);
5228: 
5229:         //fadein(suicidemouse[0]);
5230: 
5231:         while (frame < 400)
5232:         {
5233: 
5234:             if (!(frame%2))
5235:             {
5236:                 if (j < 222) j+=4;
5237:             }
5238:             if (!(frame%3))
5239:             {
5240:                 i++;
5241:             }
5242: 
5243:                 oslStartDrawing();
5244:                 spr_draw(suicidemouse[0],0,0);
5245:                 temp_gfx = oslSetImageTileSize(suicidemouse[1],(i%8)*32,0,32,42);
5246:                 temp_gfx.stretchX = 64;
5247:                 temp_gfx.stretchY = 84;
5248:                 spr_draw(temp_gfx, j, 181);
5249:                 oslEndDrawing();
5250: 
5251:             if (j >= 222)
5252:             {
5253:                 oslStartDrawing();
5254:                 spr_draw(suicidemouse[0],0,0);
5255:                 temp_gfx = oslSetImageTileSize(suicidemouse[1],256,0,32,42);
5256:                 temp_gfx.stretchX = 64;
5257:                 temp_gfx.stretchY = 84;
5258:                 spr_draw(temp_gfx, j, 181);
5259: 
5260:                 oslEndDrawing();
5261: 
5262: 
5263:                 if (frame > 248)
5264:                 {
5265:                     oslStartDrawing();
5266:                     oslDrawFillRect(0,0,480,272, _RGBA(255,0,0,155));
5267:                     suicidemouse[2]=oslSetAlpha(suicidemouse[2], 250);
5268:                     spr_draw(suicidemouse[2],238,136);
5269:                     if (!(frame%2))
5270:                         {
5271:                             suicidemouse[2].stretchX+=16;
5272:                             suicidemouse[2].stretchY+=16;
5273:                         }
5274:                     oslEndDrawing();
5275:                 }
5276:             }
5277: 
5278:             //frame_debug(frame);
5279: 
5280:             oslSwapBuffers();
5281:             frame++;
5282:             oslWaitVSync();
5283:         }
5284: 
5285:         oslDeleteImage(suicidemouse[0]);
5286:         oslDeleteImage(suicidemouse[1]);
5287:         oslDeleteImage(suicidemouse[2]);
5288:         oslDeleteSound(creepysfx);
5289: 
5290:         /*oslSetBilinearFilter(1);
5291:        
5292: 
5293:         oslDeleteSound(sfx);*/
5294: 
5295:         break;
5296: 
5297:     case 8:
5298:         creepysfx = oslLoadSoundFile("./sfx/sfx-0151.wav");
5299:         suicidemouse[0] = LoadImg("./gfx/squiward_suicide.png");
5300:         suicidemouse[1] = LoadImg("./gfx/bikini_hell.png");
5301: 
5302:         suicidemouse[0]=oslSetImageRotCenter(suicidemouse[0]);
5303:         suicidemouse[1]=oslSetImageRotCenter(suicidemouse[1]);
5304: 
5305:         oslStartDrawing();
5306:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5307:         oslEndDrawing();
5308: 
5309: 
5310:         oslSetSoundLoop(creepysfx, 0);
5311:         oslPlaySound(creepysfx);
5312: 
5313: 
5314: 
5315:         frame=0;
5316: 
5317:         while((suicidemouse[0].stretchX) >= 0)
5318:         {
5319:             if (!(frame%2))
5320:             {
5321:             oslStartDrawing();
5322:             spr_draw(suicidemouse[1],240,136);
5323:             spr_draw(suicidemouse[0],240,136);
5324:             if (!(frame%4) && (frame < 282))
5325:                 {
5326:                     suicidemouse[0].stretchX++;
5327:                     suicidemouse[0].stretchY++;
5328:                     suicidemouse[0].angle += 6;
5329:                 }
5330:             if (frame >= 282)
5331:                 {
5332:                     suicidemouse[0].stretchX-=3;
5333:                     suicidemouse[0].stretchY-=3;
5334:                     suicidemouse[0].angle -= 11;
5335:                 }
5336:             oslEndDrawing();
5337:             //frame_debug(frame);
5338:             oslSwapBuffers();
5339:             }
5340:             else
5341:             {
5342:                 oslStartDrawing();
5343:                 spr_draw(suicidemouse[1],240,136);
5344:                 spr_draw(suicidemouse[0],240,136);
5345:                 oslEndDrawing();
5346:                 oslSwapBuffers();
5347:             }
5348:             oslWaitVSync();
5349:             frame++;
5350:         }
5351: 
5352:         oslStartDrawing();
5353:         spr_draw(suicidemouse[1],240,136);
5354:         oslEndDrawing();
5355:         oslSwapBuffers();
5356: 
5357:         oslDeleteImage(suicidemouse[0]);
5358:         oslDeleteImage(suicidemouse[1]);
5359:        
5360:         oslDeleteSound(creepysfx);
5361:         /*oslSetTransparentColor(RGB(255,0,255));
5362:         oslDeleteSound(sfx);*/
5363:         break;
5364: 
5365:         case 9:
5366:         creepysfx = oslLoadSoundFile("./sfx/sfx-0152.wav");
5367: 
5368:         j=0;
5369:         i=0;
5370: 
5371:         frame=0;
5372: 
5373:         oslStartDrawing();
5374:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5375:         oslEndDrawing();
5376: 
5377:         for (k=0; k<16; k++)
5378:         {
5379:             suicidemouse[k] = LoadImg("./gfx/creepycircle.png");
5380:             suicidemouse[k] = oslSetImageRotCenter(suicidemouse[k]);
5381:         }
5382: 
5383:         while (frame<16*2)
5384:         {
5385:             if (!(frame%2))
5386:             {
5387:             bok[0][i]=(2*(random(24)+1))-24;
5388: 
5389: 
5390:             bok[1][i]= random(128)+127;
5391:             bok[2][i]= random(128)+127;
5392:             bok[3][i]= random(128)+127;
5393: 
5394: 
5395: 
5396: 
5397:             oslStartDrawing();
5398:             if (bok[0][i] > 0) suicidemouse[i].stretchX = bok[0][i]; else suicidemouse[i].stretchX = 1;
5399:             if (bok[0][i] > 0) suicidemouse[i].stretchY = bok[0][i]; else suicidemouse[i].stretchY = 1;
5400: 
5401:             spr_draw(suicidemouse[i],(i%4)*40+172, (i/4)*40+64);
5402: 
5403:             oslEndDrawing();
5404:             i++;
5405:             }
5406:             else
5407:             {
5408:                 oslWaitVSync();
5409:             }
5410:             frame++;
5411:         }
5412: 
5413:         oslSwapBuffers();
5414:         //oslWaitKey();
5415: 
5416: 
5417:         i=0;
5418:         j=0;
5419:         k=0;
5420:         frame=0;
5421: 
5422:         while(k < 100)
5423:         {
5424: 
5425:             if (!(frame%4))
5426:             {
5427:                     oslStartDrawing();
5428:                     oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5429: 
5430:                     for (j=0; j<16; j++)
5431:                     {
5432: 
5433:                         if (bok[0][j] > -24) bok[0][j]--;
5434: 
5435:                         if (bok[0][j] <= -24)
5436:                             {
5437:                                 k++;
5438:                                 bok[0][j]=24;
5439:                                 i=0;
5440:        
5441:                                 oslPlaySound(creepysfx);
5442: 
5443:                                 bok[1][j]= random(128)+127;
5444:                                 bok[2][j]= random(128)+127;
5445:                                 bok[3][j]= random(128)+127;
5446:                             }
5447: 
5448:                         if (bok[0][j] > 1) suicidemouse[j].stretchX = suicidemouse[j].stretchY = bok[0][j];
5449: 
5450:                         suicidemouse[j].R=bok[2][j];
5451:                         suicidemouse[j].G=bok[3][j];
5452:                         suicidemouse[j].B=bok[1][j];
5453: 
5454:                         if (bok[0][j] > 21)  suicidemouse[j].R=suicidemouse[j].G=suicidemouse[j].B=255;
5455: 
5456:                         spr_draw(suicidemouse[j],(j%4)*40+172, (j/4)*40+64);
5457:                     }
5458:                     oslEndDrawing();
5459:                     //frame_debug(frame);
5460:                     oslSwapBuffers();
5461:                     //oslWaitKey();
5462: 
5463: 
5464: 
5465:             }
5466:             else
5467:             {
5468:                 oslWaitVSync();
5469:             }
5470: 
5471:             frame++;
5472:         }
5473: 
5474:         for(i=0; i<16; i++) oslDeleteImage(suicidemouse[i]);
5475:         oslDeleteSound(creepysfx);
5476:         break;
5477: 
5478:     case 10:
5479:     case 15:
5480:         creepysfx = oslLoadSoundFile("./sfx/sfx-0057.wav");
5481:         sfx = oslLoadSoundFile("./sfx/bark.wav");
5482: 
5483:         suicidemouse[0] = LoadImg("./gfx/gfx-0253.png");
5484:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5485: 
5486: 
5487: 
5488:         for (i=1; i<9; i++)
5489:         {
5490:             sprintf(buffer,"./gfx/gfx-0%d.png",i+661);
5491:             suicidemouse[i]=LoadImg(buffer);
5492:             suicidemouse[i].stretchX = 480;
5493:             suicidemouse[i].stretchY = 272;
5494:         }
5495: 
5496:         frame=0;
5497:         j=0;
5498:         /*oslStopSound(w4c);*/
5499: 
5500:         oslSetSoundLoop(creepysfx, 1);
5501:         oslPlaySound(creepysfx);
5502: 
5503:         while (frame < 750)
5504:         {
5505: 
5506:             if (!(frame%16))
5507:             {
5508:                 suicidemouse[0].stretchX++;
5509:                 suicidemouse[0].stretchY = (int)(1.27*(suicidemouse[0].stretchX));
5510:             }
5511: 
5512:             if (!(frame%4))
5513:             {
5514:                 oslStartDrawing();
5515:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5516:                 spr_draw(suicidemouse[(j%8)+1],0,0);
5517:                 suicidemouse[0]=oslSetAlpha(suicidemouse[0],75);
5518:                 spr_draw(suicidemouse[0],240,136);
5519:                 oslEndDrawing();
5520:                 oslSwapBuffers();
5521:             }
5522:             else
5523:             {          
5524:                 j++;
5525:                 al_rest(0.016);
5526:             }
5527: 
5528:             frame++;
5529:             oslWaitVSync();
5530:         }
5531: 
5532:         if (cpn == 15)
5533:         {
5534:             suicidemouse[0].stretchX = 480;
5535:             suicidemouse[0].stretchY = 610;
5536:             oslStartDrawing();
5537:             suicidemouse[0]=oslSetAlpha(suicidemouse[0],255);
5538:             spr_draw(suicidemouse[0],240,136);
5539:             oslEndDrawing();
5540:             oslSwapBuffers();
5541:             oslWaitVSync();
5542:             al_set_sample_instance_position(sfx.instance, 16);
5543:             oslPlaySound(sfx);
5544:             while (al_get_sample_instance_position(sfx.instance));
5545:         }
5546: 
5547:         for (i=0; i<9; i++)
5548:         {
5549:             oslDeleteImage(suicidemouse[i]);
5550:         }
5551: 
5552:         oslDeleteSound(creepysfx);
5553:         oslDeleteSound(sfx);
5554:         fadeout();
5555:         break;
5556: 
5557:     case 11:
5558:     case 16:
5559:         suicidemouse[0] = LoadImg("./gfx/dolan.png");
5560:         creepysfx = oslLoadSoundFile("./sfx/dolan.wav");
5561: 
5562:         oslSetSoundLoop(creepysfx, 0);
5563:         i=272;
5564:         frame=0;
5565:         j=random(7);
5566: 
5567:         while(frame < 1200)
5568:         {
5569:             if (!(frame%2))
5570:             {
5571:                 if (i>72)
5572:                 {
5573:                 oslStartDrawing();
5574:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5575:                 spr_draw(suicidemouse[0], 332, i);
5576:                 oslEndDrawing();
5577:                 oslSwapBuffers();
5578:                 oslWaitVSync();
5579:                 i--;
5580:                 }
5581:                 if ((frame > 800) && (i<73))
5582:                 {
5583:                     if (cpn == 16)
5584:                     {
5585:                         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5586:                         suicidemouse[0].stretchX = 480;
5587:                         suicidemouse[0].stretchY = 648;
5588:                         oslStartDrawing();
5589:                         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5590:                         spr_draw(suicidemouse[0],240,136);
5591:                         oslEndDrawing();
5592:                         oslSwapBuffers();
5593:                         if (frame == 812) oslPlaySound(creepysfx);
5594:                         oslWaitVSync();
5595:                     }
5596:                     else
5597:                     {
5598:                         oslStartDrawing();
5599:                         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5600:                         spr_draw(suicidemouse[0], 332, i+1);
5601:                         oslSetTextColor(_RGB(255, 255, 255));
5602:                         k = oslGetStringWidth(text[j]);
5603:                         oslDrawString((480 - k)/2, 32, text[j]);
5604:                         oslEndDrawing();
5605:                         oslSwapBuffers();
5606:                         oslWaitVSync();
5607:                     }
5608:                 }
5609:                 oslWaitVSync();
5610:             }
5611:             else
5612:             {
5613:                 al_rest(0.008);
5614:             }
5615:             frame++;
5616:             oslWaitVSync();
5617:         }
5618: 
5619:         oslDeleteImage(suicidemouse[0]);
5620:         oslDeleteSound(creepysfx);
5621: 
5622:        /* while (oslGetSoundChannel(creepysfx) == 1);
5623:        
5624:         oslDeleteSound(sfx);*/
5625: 
5626:         break;
5627: 
5628:         case 12:
5629:         k=random(42);
5630:         j=random(25);
5631: 
5632:         sprintf(buffer,"./sfx/sfx-0%d.wav",j+121);
5633:         creepysfx = oslLoadSoundFile(buffer);
5634: 
5635:         j=random(25);
5636:         sprintf(buffer,"./sfx/sfx-0%d.wav",j+121);
5637:         sfx = oslLoadSoundFile(buffer);
5638: 
5639:         sprintf(buffer,"./gfx/pasta%d.png",k+1);
5640:         suicidemouse[0] =  LoadImg(buffer);
5641: 
5642:         oslSetSoundLoop(creepysfx, 0);
5643:         al_set_sample_instance_position(creepysfx.instance, 16);
5644:         oslPlaySound(creepysfx);
5645:         suicidemouse[0]=oslSetImageRotCenter(suicidemouse[0]);
5646: 
5647:         frame=0;
5648: 
5649:         //oslSetBilinearFilter(1);
5650: 
5651:         while (al_get_sample_instance_position(creepysfx.instance))
5652:         {
5653:             oslStartDrawing();
5654:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5655:             spr_draw(suicidemouse[0], 240, 136);
5656:             oslEndDrawing();
5657:             oslSwapBuffers();
5658:             oslWaitVSync();
5659:             if (!(frame%4)) suicidemouse[0].stretchX++;
5660:             suicidemouse[0].stretchY = (int)((float)(suicidemouse[0].sizeY)/(suicidemouse[0].sizeX)*suicidemouse[0].stretchX);
5661:             frame++;
5662:         }
5663: 
5664:         oslSetSoundLoop(sfx, 0);
5665:         al_set_sample_instance_position(sfx.instance, 16);
5666:         oslPlaySound(sfx);
5667: 
5668:         while (al_get_sample_instance_position(sfx.instance))
5669:         {
5670:                 oslStartDrawing();
5671:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5672:                 spr_draw(suicidemouse[0], 240, 136);
5673:                 oslEndDrawing();
5674:                 oslSwapBuffers();
5675:                 oslWaitVSync();
5676:                 if (!(frame%4)) suicidemouse[0].stretchX++;
5677:                 suicidemouse[0].stretchY = (int)((float)(suicidemouse[0].sizeY)/(suicidemouse[0].sizeX)*suicidemouse[0].stretchX);
5678:                 frame++;
5679:         }
5680: 
5681:         //oslSetBilinearFilter(0);
5682: 
5683:         oslDeleteSound(creepysfx);
5684:         oslDeleteImage(suicidemouse[0]);
5685:         oslDeleteSound(sfx);
5686: 
5687:         break;
5688: 
5689: case 13:
5690:        
5691:         creepysfx = oslLoadSoundFile("./sfx/sfx-0150.wav");
5692: 
5693:         oslSetSoundLoop(creepysfx, 0);
5694:         al_set_sample_instance_position(creepysfx.instance, 16);
5695:         oslPlaySound(creepysfx);
5696:        
5697:         oslStartDrawing();
5698:         oslDrawFillRect(0,0,480,272, _RGB(0,0,255));
5699:         oslSetTextColor(_RGB(255, 255, 255));
5700: 
5701:         al_draw_text(freesans, current_col, 8, 0, 0, "FATAL ERROR OCURRED IN THREAD");
5702:         al_draw_text(freesans, current_col, 8, 12, 0, "Shit happens... :-(");
5703:         al_draw_text(freesans, current_col, 8, 36, 0, "Exception Details:");
5704:         al_draw_text(freesans, current_col, 8, 48, 0, "Exception - Bus error (death)");
5705:         al_draw_text(freesans, current_col, 8, 60, 0, "EPC       - 08A1C208");
5706:         al_draw_text(freesans, current_col, 8, 72, 0, "Cause     - 07H30P13");
5707:         al_draw_text(freesans, current_col, 8, 84, 0, "Status    - D34D0L0L");
5708:         al_draw_text(freesans, current_col, 8, 96, 0, "BadVAddr  - 0012AC40");
5709:         al_draw_text(freesans, current_col, 8, 108, 0, "zr:000Y0000 at:0008OF00 v0:000U0000 v1:00000012");
5710:         al_draw_text(freesans, current_col, 8, 120, 0, "a0:0000A001 a1:000R002E a2:09FFE768 a3:09FF06BC");
5711:         al_draw_text(freesans, current_col, 8, 132, 0, "t0:00D0E6BC t1:000E07D4 t2:0000A032 t3:8804D000");
5712:         al_draw_text(freesans, current_col, 8, 144, 0, "t4:09FFY5F8 t5:000O0E00 t6:08A2U658 t7:00008600");
5713:         al_draw_text(freesans, current_col, 8, 156, 0, "t8:000S0000 t9:000U8368 s0:08AC0000 s1:08AFK53C");
5714:         al_draw_text(freesans, current_col, 8, 168, 0, "s2:08BA0C20 s3:08BT453C s4:08A30000 s5:08A30000");
5715:         al_draw_text(freesans, current_col, 8, 180, 0, "s6:000T00EC s7:0000H0F9 k0:09FFIF00 k1:0000S000");
5716:         al_draw_text(freesans, current_col, 8, 192, 0, "gp:08AGD390 sp:000AFF00 fp:08A3M000 ra:0896E4BC");
5717:         al_draw_text(freesans, current_col, 8, 216, 0, "Will exit to Windows desktop in 10 seconds");
5718:         oslEndDrawing();
5719:         oslSwapBuffers();
5720: 
5721:         while (al_get_sample_instance_position(creepysfx.instance));
5722:         oslDeleteSound(creepysfx);
5723:         fadeout();
5724:         break;
5725: 
5726: 
5727:     case 14:
5728:         if (random(2)) suicidemouse[0] =  LoadImg("./gfx/smilechu.png"); else suicidemouse[0] =  LoadImg("./gfx/smilechu2.png");
5729:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5730: 
5731:         i=0;
5732:         j=0;
5733:         frame=0;
5734: 
5735:             while (i < 12)
5736:             {
5737:                 if (!(frame%3))
5738:                 {
5739:                     if (!j)
5740:                     {
5741:                         k=random(70);
5742:                         suicidemouse[0].stretchX = 10+random(150);
5743:                         l=82+random(36);
5744:                     }
5745:                     else k++;
5746:                     oslStartDrawing();
5747:                     oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5748:                     if (k>44)
5749:                     {
5750:                         j=1;
5751: 
5752:                         if (k < 74)
5753:                         {
5754:                             suicidemouse[0].stretchX += 13;
5755:                             suicidemouse[0].stretchY = (int)(1.18 * (suicidemouse[0].stretchX));
5756: 
5757:                             spr_draw(suicidemouse[0],240,138);
5758:                         }
5759: 
5760:                         if (k==l)
5761:                         {
5762:                             i++;
5763:                             j=0;
5764:                         }
5765:                     }
5766:                     //frame_debug(k);
5767:                     oslEndDrawing();
5768:                     oslSwapBuffers();
5769:                     oslWaitVSync();
5770:                 }
5771:                 else
5772:                 {
5773:                     al_rest(0.008);
5774:                     oslWaitVSync();
5775:                 }
5776:                 frame++;
5777:                 oslWaitVSync();
5778:             }
5779: 
5780:         oslDeleteImage(suicidemouse[0]);
5781:         //oslDeleteSound(sfx);
5782:     break;
5783: 
5784:         case 17:
5785:         suicidemouse[0] =  LoadImg("./gfx/nigel.png");
5786:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5787: 
5788:         creepysfx = oslLoadSoundFile("./sfx/smashing.wav");
5789: 
5790:         frame=0;
5791: 
5792:         oslPlaySound(creepysfx);
5793: 
5794:         while (frame<512)
5795:         {
5796:                 oslStartDrawing();
5797:                 oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5798: 
5799:                 for(i=0; i<8; i++)
5800:                 {
5801:                         j=random(10)-20;
5802:                         oslDrawFillRect(i*60,120+j,(i*60)+60,152+(-1*j), _RGB(96,96,0));
5803:                         oslDrawFillRect(i*60,128+j,(i*60)+60,144+(-1*j), _RGB(128,128,0));
5804:                         oslDrawFillRect(i*60,136+j,(i*60)+60,136+(-1*j), _RGB(160,160,0));
5805:                 }
5806: 
5807:                 if (frame >= 480)
5808:                 {
5809: 
5810:                     spr_draw(suicidemouse[0],240,138);
5811: 
5812:                         suicidemouse[0].stretchX += 16;
5813:                         suicidemouse[0].stretchY = (int)(1.33*(suicidemouse[0].stretchX));
5814:                 }
5815:                 oslEndDrawing();
5816:                 oslSwapBuffers();
5817:                 oslWaitVSync();
5818:                 frame++;
5819:         }
5820: 
5821:         oslDeleteSound(creepysfx);
5822:         oslDeleteImage(suicidemouse[0]);
5823: 
5824:     break;
5825: 
5826:     case 18:
5827:         suicidemouse[0] =  LoadImg("./gfx/caaat.png");
5828:         suicidemouse[1] =  LoadImg("./gfx/caaat_ns.png");
5829:         creepysfx = oslLoadSoundFile("./sfx/caaat.wav");
5830:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5831:         suicidemouse[1] = oslSetImageRotCenter(suicidemouse[1]);
5832: 
5833:         al_set_sample_instance_position(creepysfx.instance, 16);
5834:         oslPlaySound(creepysfx);
5835: 
5836:         frame=0;
5837: 
5838:         while (al_get_sample_instance_position(creepysfx.instance))
5839:         {
5840:             oslStartDrawing();
5841:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5842: 
5843:             if (frame<150)
5844:             {
5845:                 spr_draw(suicidemouse[1],240,138);
5846:             }
5847:             else
5848:             {
5849:                 spr_draw(suicidemouse[0],240,138);
5850:             }
5851: 
5852:             oslEndDrawing();
5853:             oslSwapBuffers();
5854:             oslWaitVSync();
5855:             frame++;
5856:         }
5857:         oslDeleteSound(creepysfx);
5858:         oslDeleteImage(suicidemouse[0]);
5859:         oslDeleteImage(suicidemouse[1]);
5860:     break;
5861: 
5862:     case 19:
5863:         for (i=0; i<9; i++)
5864:                 {
5865:                     sprintf(buffer,"./gfx/pona0%d.png",i);
5866:                     suicidemouse[i]=LoadImg(buffer);
5867: 
5868:                     suicidemouse[i].stretchX = 480;
5869:                     suicidemouse[i].stretchY = 272;
5870:                     suicidemouse[i]=oslSetImageRotCenter(suicidemouse[i]);
5871:                 }
5872: 
5873:         frame=0;
5874: 
5875:         creepysfx = oslLoadSoundFile("./sfx/pona.wav");
5876:         oslPlaySound(creepysfx);
5877: 
5878:         i=0;
5879: 
5880:         while (frame < 333)
5881:         {
5882: 
5883:             oslStartDrawing();
5884:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5885: 
5886:             if (frame < 110)
5887:             {
5888:                 spr_draw(suicidemouse[frame/14],240,138);
5889:             }
5890: 
5891:             if ((frame >= 110) && (frame <= 140))
5892:             {
5893:                 spr_draw(suicidemouse[8],240,138);
5894:             }
5895: 
5896:             oslEndDrawing();
5897:             //frame_debug((int)oslGetRamStatus().maxAvailable);
5898:             oslSwapBuffers();
5899: 
5900:             oslWaitVSync();
5901:             frame++;
5902:         }
5903: 
5904:         oslDeleteSound(creepysfx);
5905:         for (i=0; i<9; i++)
5906:         {
5907:             oslDeleteImage(suicidemouse[i]);
5908:         }
5909:         break;
5910: 
5911:     case 20:
5912:         suicidemouse[0] =  LoadImg("./gfx/pookey1.png");
5913:         suicidemouse[1] =  LoadImg("./gfx/pookey2.png");
5914:         creepysfx = oslLoadSoundFile("./sfx/pookeymon.wav");
5915:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5916:         suicidemouse[1] = oslSetImageRotCenter(suicidemouse[1]);
5917: 
5918:         oslPlaySound(creepysfx);
5919: 
5920:         frame=0;
5921: 
5922:         while(frame < 550)
5923:         {
5924:             oslStartDrawing();
5925:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5926: 
5927:             if ((frame >= 375) && (frame < 389)) spr_draw(suicidemouse[0], 240, 136);
5928:             if ((frame >= 389) && (frame < 401)) spr_draw(suicidemouse[1], 240, 136);
5929: 
5930:             oslEndDrawing();
5931:             oslSwapBuffers();
5932: 
5933:             oslWaitVSync();
5934: 
5935:             frame++;
5936:         }
5937: 
5938:         oslDeleteImage(suicidemouse[0]);
5939:         oslDeleteImage(suicidemouse[1]);
5940:         oslDeleteSound(creepysfx);
5941:         break;
5942: 
5943:     case 21:
5944:         suicidemouse[0] =  LoadImg("./gfx/gfx-0825.png");
5945:         creepysfx = oslLoadSoundFile("./sfx/sfx-0030.wav");
5946:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
5947: 
5948:         oslPlaySound(creepysfx);
5949: 
5950:         frame=0;
5951: 
5952:         suicidemouse[0].stretchX = i = 396;
5953:         suicidemouse[0].stretchY = (int)(1.68*suicidemouse[0].stretchX);
5954: 
5955:         while(frame < 480)
5956:         {
5957:             oslStartDrawing();
5958:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
5959: 
5960: 
5961:             i=suicidemouse[0].stretchX;
5962: 
5963:             if ((suicidemouse[0].stretchX) > -72)
5964:             {
5965: 
5966:                 if (suicidemouse[0].stretchX >= 0)
5967:                 {
5968:                     suicidemouse[0].trans=255;
5969:                     spr_draw(suicidemouse[0], 240, 136);
5970:                 }
5971: 
5972:                 if (suicidemouse[0].stretchX >= -36)
5973:                 {
5974:                     suicidemouse[0].stretchX += 36;
5975:                     suicidemouse[0].stretchY = (int)(1.68* (suicidemouse[0].stretchX));
5976: 
5977: 
5978:                     suicidemouse[0].trans=128;
5979:                     spr_draw(suicidemouse[0], 240, 136);
5980:                 }
5981: 
5982: 
5983:                 suicidemouse[0].stretchX += ((suicidemouse[0].stretchX < -36)?72:36);
5984:                 suicidemouse[0].stretchY = (int)(1.68* (suicidemouse[0].stretchX));
5985: 
5986:                 suicidemouse[0].trans=64;
5987:                 spr_draw(suicidemouse[0], 240, 136);
5988:             }
5989: 
5990:             suicidemouse[0].stretchX = i;
5991: 
5992:             if (!(frame%5))
5993:             {
5994:                 suicidemouse[0].stretchX = i - 18;
5995:             }
5996: 
5997:             suicidemouse[0].stretchY = (int)(1.68*suicidemouse[0].stretchX);
5998: 
5999:             oslEndDrawing();
6000:             oslSwapBuffers();
6001:             oslWaitVSync();
6002:             frame++;
6003:         }
6004: 
6005:         oslDeleteImage(suicidemouse[0]);
6006:         oslDeleteSound(creepysfx);
6007:         break;
6008: 
6009:     case 22:
6010:         suicidemouse[0] =  LoadImg("./gfx/lavender.png");
6011:         creepysfx = oslLoadSoundFile("./sfx/lavender.wav");
6012: 
6013:         temp_gfx = oslSetImageTileSize(suicidemouse[0],0,0,48,48);
6014:         temp_gfx = oslSetImageRotCenter(temp_gfx);
6015:         oslPlaySound(creepysfx);
6016: 
6017:         frame=0;
6018: 
6019:         while(frame < 420)
6020:         {
6021:             oslStartDrawing();
6022:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6023: 
6024:             if (frame <= 341)
6025:             {
6026:                 temp_gfx.trans=random(128);
6027:                 temp_gfx.stretchX = temp_gfx.stretchY = 96;
6028:             }
6029:             else
6030:             {
6031:                 temp_gfx.trans=255;
6032:                 temp_gfx = oslSetImageTileSize(suicidemouse[0],48,0,48,48);
6033:                 temp_gfx = oslSetImageRotCenter(temp_gfx);
6034:                 temp_gfx.stretchX = temp_gfx.stretchY = 640;
6035:             }
6036: 
6037:             if (frame < 395) spr_draw(temp_gfx, 240+((frame>341)?0:random(4)), 136+((frame>341)?104:random(4)));
6038: 
6039:             oslEndDrawing();
6040:             oslSwapBuffers();
6041:             oslWaitVSync();
6042:             frame++;
6043:         }
6044: 
6045: 
6046:         oslDeleteImage(suicidemouse[0]);
6047:         oslDeleteSound(creepysfx);
6048:         break;
6049: 
6050:     case 23:
6051:         frame=0;
6052:         suicidemouse[0] =  LoadImg("./gfx/c64.png");
6053:         suicidemouse[1] =  LoadImg("./gfx/c64-ar.png");
6054: 
6055:         while (frame < 360)
6056:         {
6057:             oslStartDrawing();
6058:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6059:             oslDrawFillRect(60, 0, 420, 272, _RGB(165,165,255));
6060:             oslDrawFillRect(80, 46, 400, 226, _RGB(66,66,231));
6061: 
6062:             if (frame < 150)
6063:             {
6064:                 for(i=0; i<1000; i++)
6065:                 {
6066:                      spr_draw(suicidemouse[1], (i%40)*8+80, ((int)(i/40))*8+38);
6067:                 }
6068:             }
6069:             else
6070:             {
6071:                  spr_draw(suicidemouse[0], 80, 46);
6072:                  if ((frame%60) < 30)
6073:                  {
6074:                      oslDrawFillRect(80, 94, 88, 102, _RGB(165,165,255));
6075:                  }
6076:             }
6077:             oslEndDrawing();
6078:             oslSwapBuffers();
6079:             oslWaitVSync();
6080:             frame++;
6081:         }
6082:         oslDeleteImage(suicidemouse[0]);
6083:         oslDeleteImage(suicidemouse[1]);
6084:         break;
6085: 
6086:     case 24:
6087:         suicidemouse[0] =  LoadImg("./gfx/sncell.png");
6088:         suicidemouse[1] =  LoadImg("./gfx/sncpnt.png");
6089:         suicidemouse[0] = oslSetImageRotCenter(suicidemouse[0]);
6090:         creepysfx = oslLoadSoundFile("./sfx/nuls.wav");
6091: 
6092:         al_set_sample_instance_position(creepysfx.instance, 16);
6093:         oslPlaySound(creepysfx);
6094: 
6095:         frame=0;
6096: 
6097:         while (al_get_sample_instance_position(creepysfx.instance))
6098:         {
6099:             oslStartDrawing();
6100:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6101:             spr_draw(suicidemouse[0], 236+random(7), 132+random(7));
6102:             spr_draw(suicidemouse[1], 224+random(7), 132+random(7));
6103:             spr_draw(suicidemouse[1], 246+random(7), 132+random(7));
6104:             oslEndDrawing();
6105:             oslSwapBuffers();
6106:             oslWaitVSync();
6107:         }
6108: 
6109:         oslStartDrawing();
6110:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6111:         oslEndDrawing();
6112:         oslSwapBuffers();
6113:         fadeout();
6114: 
6115:         oslDeleteImage(suicidemouse[0]);
6116:         oslDeleteImage(suicidemouse[1]);
6117:         oslDeleteSound(creepysfx);
6118: 
6119:         cls();
6120:         break;
6121:     }
6122: 
6123: 
6124:     fadeout();
6125: }
6126: 
6127: void ben()
6128: {
6129:     OSL_IMAGE noise[9];
6130:     ALLEGRO_BITMAP *ben_sub;
6131:     OSL_SOUND ben_mzx =  oslLoadSoundFile("./sfx/ben.wav");
6132:     char buffer[20];
6133:     int i, j, frame=0, trans;
6134: 
6135:     noise[0]=LoadImg("./gfx/ben.png");
6136: 
6137:     for (i=1; i<9; i++)
6138:     {
6139:         sprintf(buffer,"./gfx/gfx-0%d.png",i+661);
6140:         noise[i]=LoadImg(buffer);
6141:         noise[i].stretchX = 480;
6142:         noise[i].stretchY = 272;
6143:     }
6144: 
6145:     oslPlaySound(ben_mzx);
6146: 
6147:     while(frame<704)
6148:     {
6149:         oslStartDrawing();
6150:         oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6151:         spr_draw(noise[(frame%8)+1],0,0);
6152: 
6153:         if (frame<192)
6154:         {
6155:             trans=frame;
6156:         }
6157:         else if (frame>512) trans=704-frame;
6158:         else trans=192;
6159: 
6160:         i=0;
6161:         while(i<272)
6162:         {
6163:             j=random(27)+13;
6164:             ben_sub=al_create_sub_bitmap(noise[0].asset,0,i,425,i+j);
6165:             al_draw_tinted_bitmap(ben_sub, al_map_rgba(255, 255, 255, trans), random(55), i, 0);
6166:             i += j;
6167:         }
6168: 
6169:         oslEndDrawing();
6170:         oslSwapBuffers();
6171:         oslWaitVSync();
6172:         frame++;
6173:     }
6174: 
6175:     for(i=0; i<9; i++)
6176:     {
6177:         oslDeleteImage(noise[i]);
6178:     }
6179:    
6180:     oslDeleteSound(ben_mzx);
6181: 
6182:     fadeout();
6183: }
6184: 
6185: void rndsft()
6186: {
6187:     int frame=-3, i=0, j=0, k=0, l=0, m=0, n=0;
6188:     OSL_IMAGE rndsft, px;
6189:     ALLEGRO_BITMAP *rndsft_sub;
6190:     OSL_MOD rndtheme;
6191: 
6192:     rndsft = LoadImg("./gfx/rndsft.png");
6193:     px = LoadImg("./gfx/pixel.png");
6194:     rndtheme = oslLoadSoundFileMOD("./muzaxx/rndsft.xm");
6195: 
6196: 
6197:     rndsft=oslSetImageRotCenter(rndsft);
6198: 
6199:     oslSetSoundLoopMOD(rndtheme, 0);
6200:     oslPlaySoundMOD(rndtheme);  
6201: 
6202:     while(frame<470)
6203:     {
6204: 
6205: 
6206:         oslStartDrawing();
6207:         al_clear_to_color(_RGB(0, 0, 0));
6208: 
6209:         if (frame >= 161)
6210:         {
6211:             if (frame-160 < 35) rndsft_sub=al_create_sub_bitmap(rndsft.asset, 0, 0, 282, frame-160); else rndsft_sub=al_create_sub_bitmap(rndsft.asset, 0, 0, 282, frame-160);
6212:             al_draw_bitmap(rndsft_sub, (480-rndsft.sizeX)/2, (272-rndsft.sizeY)/2, 0);
6213:         }
6214: 
6215:         if ((frame >= 200) && (frame <= 220))
6216:         {
6217:             if (frame==200) i=random(360);
6218: 
6219:             if (!(frame%2))
6220:             {
6221:                 oslDrawFillRect(0, 0, 480, 272, _RGB(0,0,0));
6222: 
6223:                 for (j=0; j<13; j++)
6224:                 {
6225:                     oslDrawFillRect(i+j*16, 60, i+j*16+8, 272, _RGB(255,127,0));
6226:                 }
6227:             }
6228:         }
6229: 
6230:         if ((frame >= 259) && (frame <= 295))
6231:         {
6232: 
6233:             if (frame == 259)
6234:             {
6235:                 i=random(32)+24;
6236:                 k=random(9)+6;
6237:                 oslSetTextColor(_RGB(0, 224, 0));
6238:                 m=random(127);
6239:                 n=random(44);
6240:             }
6241: 
6242:             for(j=0; j<k; j++)
6243:             {
6244:                 for (l=0; l<i; l++)
6245:                 {
6246:                     oslDrawString(m+l*6, n+j*12, "@");
6247:                 }
6248:             }
6249:         }
6250: 
6251:         if ((frame >= 336) && (frame <= 345))
6252:         {
6253:             oslDrawFillRect(0,0,480,272, _RGB(0,0,0));
6254:             spr_draw(rndsft,random(480),random(272));
6255:         }
6256: 
6257:         if (frame >= 369)
6258:         {
6259: 
6260:                 for(i=0; i<48; i++)
6261:                 {
6262:                     for (j=0; j<17;  j++)
6263:                     {
6264:                         al_draw_pixel(i*10, j*16, _RGB(random(256), random(256), random(256)));
6265:                     }
6266:                 }
6267: 
6268:             if ((frame == 369) || (!(frame%4))) k=random(360);
6269:             oslDrawFillRect(k,0,k+32,272, _RGB(0,254,255));
6270: 
6271: 
6272:         }
6273: 
6274:         oslEndDrawing();
6275:         oslSwapBuffers();
6276:         frame++;
6277:         oslWaitVSync();
6278: 
6279:     }
6280: 
6281:     oslDeleteImage(rndsft);
6282:     oslDeleteImage(px);
6283:     oslStopSoundMOD(rndtheme);
6284:     fadeout();
6285: }
6286: 
6287: int warning_onepilepsy()
6288: {
6289:     OSL_IMAGE warning = LoadImg("./gfx/warning.png");
6290:     OSL_MOD theme = oslLoadSoundFileMOD("./muzaxx/giygas.xm");
6291: 
6292:     int i, w, frame=0, quit=0, red=0, accept=0;
6293:     const char *text[8] = {"This game contains flashing patterns that may cause","epileptic seizures when players attempt to see them.","It also contains strange pictures that may cause some players","to have brief but intense adrenaline surges in their body."," ","Consult a doctor if you experience","unusual symptoms while playing games!","Press SPACE to play or ESC to quit"};
6294: 
6295:     warning.stretchX = 360;
6296: 
6297:     warning=oslSetImageRotCenter(warning);
6298:    
6299:     oslPlaySoundMOD(theme);
6300: 
6301:     while (!quit)
6302:     {
6303:         oslStartDrawing();
6304:         al_clear_to_color(_RGB(0, 0, 0));
6305: 
6306: 
6307:     for (i=0; i<7; i++)
6308:     {
6309:         if (i<5) oslSetTextColor(_RGB(255, 255, 255));
6310:         if (i>4) oslSetTextColor(_RGB(255, 255, 0));
6311:         w = oslGetStringWidth(text[i]);
6312:         oslDrawString((480 - w)/2, 92+i*20, text[i]);
6313:     }
6314: 
6315:     warning.angle = 7*sin((0.25*frame)/3.14);
6316: 
6317:     spr_draw(warning, 240, 32);
6318: 
6319:     oslSetTextColor(_RGB(red, 0, 0));
6320:     w = oslGetStringWidth(text[7]);
6321:     oslDrawString((480 - w)/2, 256, text[7]);
6322:     red -= 3;
6323:     if (red < 0) red=255;
6324: 
6325:     al_get_keyboard_state(&kbdstate);
6326:     if (al_key_down(&kbdstate, ALLEGRO_KEY_SPACE) || al_key_down(&kbdstate, ALLEGRO_KEY_ENTER))
6327:         {
6328:             accept=1;
6329:             quit=1;
6330:         }
6331:     else if (al_key_down(&kbdstate, ALLEGRO_KEY_ESCAPE))
6332:         {
6333:             accept=0;
6334:             quit=1;
6335:         }
6336: 
6337:     oslEndDrawing();
6338:     oslSwapBuffers();
6339:     oslWaitVSync();
6340:     frame++;
6341:     }
6342: 
6343:     //oslFlushKey();
6344: 
6345:     //oslSetBilinearFilter(0);
6346:     fadeout();
6347:     oslStopSoundMOD(theme);
6348:     oslDeleteSoundMOD(theme);
6349: 
6350:     return accept;
6351: }
6352: 
6353: int main()
6354: {
6355:     short i, a, tx=0, ty=0, gt=0, ch=0, chd=1, mort=0, vies=2, round=1, f=0, nbp=1, fs=0, quit=0, rebound=0;
6356:     int q=strlen("v2.00"), scrw, scrh, h=100;
6357:     const char *items[4] = {"CHALLENGE THE PIE", "DIFFICULTY:", "WHO DID THIS MESS?", "FLEE TO WINDOWS LIKE A COWARD"};
6358:     const char *diffs[3] = {"WUSS", "MANLY", "HELL"};
6359:     OSL_IMAGE hand;
6360:     OSL_IMAGE title;
6361:     OSL_IMAGE alice;
6362:     OSL_SOUND crack;
6363:     OSL_SOUND theme;
6364:  
6365:    srand(time(NULL));
6366: 
6367:    if(!al_init()) {
6368:       fprintf(stderr, "failed to initialize allegro!\n");
6369:       exit(-1);
6370:    }
6371:  
6372:    al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_REQUIRE);
6373:    al_set_new_display_option(ALLEGRO_SINGLE_BUFFER, 1, ALLEGRO_REQUIRE);
6374:    al_set_new_display_option(ALLEGRO_RENDER_METHOD, 0, ALLEGRO_REQUIRE);
6375:    al_set_new_display_flags(ALLEGRO_FULLSCREEN);
6376: 
6377:    al_init_image_addon();
6378:    al_init_primitives_addon();
6379:    al_init_ttf_addon();
6380:    al_install_audio();
6381:    al_init_acodec_addon();
6382:    al_install_keyboard();
6383: 
6384:    timer=al_create_timer(1.0 / 60);
6385:    event_queue = al_create_event_queue();
6386: 
6387:    //al_reserve_samples(16);
6388:    voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2);
6389:    mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_2);
6390:  
6391:     al_attach_mixer_to_voice(mixer, voice);
6392: 
6393:     al_set_new_bitmap_flags(ALLEGRO_NO_PREMULTIPLIED_ALPHA);
6394:     al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
6395:     al_set_new_display_refresh_rate(60);
6396: 
6397:    freesans = al_load_ttf_font("./fonts/Nouveau_IBM.ttf", 11, 0); //ALLEGRO_TTF_MONOCHROME);
6398: 
6399:    court=LoadImg("./gfx/court_hell.png");
6400:    benj=LoadImg("./gfx/boktai.png");
6401: 
6402:    crack = oslLoadSoundFile("./sfx/sfx-0026.wav");
6403:    theme = oslLoadSoundFile("./sfx/theme.wav");
6404: 
6405:    ratio=getScreenRatio();
6406: 
6407:    if (ratio < 160)
6408:    {
6409:        scrw=800;
6410:        scrh=600;
6411:    }
6412:    else if (ratio > 160)
6413:    {
6414:        scrw=1280;
6415:        scrh=720;
6416:    }
6417:    else if (ratio == 160)
6418:    {
6419:        scrw=1280;
6420:        scrh=800;
6421:    }
6422: 
6423:    display = al_create_display(scrw, scrh);
6424:    al_hide_mouse_cursor(display);
6425: 
6426:    psp_screen = al_create_bitmap(480, 272);
6427: 
6428:    
6429:     hand = LoadImg("./gfx/hand.png");
6430:     title = LoadImg("./gfx/title.png");
6431:     alice = LoadImg("./gfx/alice.png");
6432: 
6433:     for (a=0; a<90; a++)
6434:     {
6435:         oslStartDrawing();
6436:         oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
6437:         oslEndDrawing();
6438:         oslSwapBuffers();
6439:         oslWaitVSync();
6440:     }
6441:    
6442:    a=warning_onepilepsy();
6443: 
6444:    
6445: 
6446:    if (a)
6447:    {
6448: 
6449:        rndsft();
6450: 
6451:         while ((ch != 137) && (!quit))
6452:         {
6453:             oslStartDrawing();
6454:             if (!f) oslPlaySound(theme);
6455: 
6456:             if (!(f%6))
6457:             {
6458:                 tx=random(16);
6459:                 ty=random(32);
6460:             }
6461: 
6462:             chd=chd%3;
6463: 
6464:             oslSetTextColor(_RGBA(255, 255, 255, gt));
6465:             oslDrawFillRect(0,0,480,272, _RGB(0, 0, 0));
6466: 
6467:             title=oslSetAlpha(title, gt);
6468:             spr_draw(title, tx, ty);
6469: 
6470:             title=oslSetAlpha(title, gt/2);
6471:             spr_draw(title, random(16), random(32));
6472: 
6473:             title=oslSetAlpha(title, gt/4);
6474:             spr_draw(title, random(16), random(32));
6475: 
6476:             alice=oslSetAlpha(alice, gt);
6477:             spr_draw(alice, 299, 0);
6478: 
6479:             oslDrawString(480-(q*6), 260, "v2.00");
6480: 
6481:             for (i=0; i<4; i++)
6482:             {
6483:                 oslDrawString(48, 182+i*20, items[i]);
6484:                 if ((!i) && (nbp==2))  oslDrawString(162, 182, "(AGAINST A MORTAL)");
6485:             }
6486: 
6487:             hand=oslSetAlpha(hand,gt);
6488:             spr_draw(hand, 8+4*sin(0.0625*f), 186+ch*20);
6489: 
6490:             oslSetTextColor(_RGBA(255, ((chd<2)?(255/(chd+1)):0), 0, gt));
6491:             oslDrawString(120, 202, diffs[chd]);
6492: 
6493: 
6494: 
6495:             if (gt < 255) gt++;
6496: 
6497:             al_get_keyboard_state(&kbdstate);
6498: 
6499:             if ((!al_key_down(&kbdstate, ALLEGRO_KEY_UP) && !al_key_down(&kbdstate, ALLEGRO_KEY_DOWN) &&
6500:                 !al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT) && !al_key_down(&kbdstate, ALLEGRO_KEY_LEFT) &&
6501:                 !al_key_down(&kbdstate, ALLEGRO_KEY_ENTER))) rebound=0;
6502: 
6503:             if (!rebound)
6504:             {
6505:                 if (al_key_down(&kbdstate, ALLEGRO_KEY_UP)) ch--;
6506:                 if (al_key_down(&kbdstate, ALLEGRO_KEY_DOWN)) ch++;
6507:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (ch==1)) chd++;
6508: 
6509:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) && (ch==0) && (nbp==1)) nbp++;
6510:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (ch==0) && (nbp==2)) nbp--;
6511: 
6512:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) && (ch==1))
6513:                     {
6514:                         chd--;
6515:                         if (chd < 0) chd=2;
6516:                     }
6517:                 if ((al_key_down(&kbdstate, ALLEGRO_KEY_UP) || al_key_down(&kbdstate, ALLEGRO_KEY_DOWN) ||
6518:                 al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT) || al_key_down(&kbdstate, ALLEGRO_KEY_LEFT))) rebound=1;
6519: 
6520:             }
6521: 
6522:            
6523:             if (ch < 0) ch += 4;
6524:             else if (ch > 3) ch -= 4;
6525:                    
6526:             f++;
6527:            
6528:             if (al_key_down(&kbdstate, ALLEGRO_KEY_ESCAPE))
6529:             {
6530:                 ch=137;
6531:                 quit=1;
6532:             }
6533: 
6534:             if (al_key_down(&kbdstate, ALLEGRO_KEY_C))
6535:             {
6536:                 oslStopSound(theme);
6537:                 fadeout();
6538:                 for (i=0; i<25; i++) creepypasta(i);
6539:                 oslPlaySound(theme);
6540:             }
6541: 
6542:             if ((al_key_down(&kbdstate, ALLEGRO_KEY_ENTER)) && (!rebound) && (!quit))
6543:             {
6544:                 rebound=1;
6545:                
6546:                 if (!(ch%2)) fadeout();
6547:                    
6548:                     switch(ch)
6549:                     {
6550: 
6551:                         case 0:
6552:                         {
6553:                             vies=2;
6554:                             mort=0;
6555:                             round=1;
6556:                             f=-1;
6557: 
6558:                             oslStopSound(theme);
6559: 
6560:                             while ((vies > 0) && (round < 3))
6561:                             {
6562:                                 mort=game(round, chd+1, nbp);
6563: 
6564:                                 counter=0;
6565:                                 if ((!mort) || (mort==2))
6566:                                 {
6567:                                     i=random(25);
6568: 
6569:                                     if (!mort)
6570:                                     {
6571:                                         oslPlaySound(crack);
6572: 
6573:                                             for (a=0; a<15; a++)
6574:                                             {
6575:                                                 oslStartDrawing();
6576:                                                 oslDrawFillRect(0,0,480,272, _RGB(255, 255, 255));
6577:                                                 oslEndDrawing();
6578:                                                 oslSwapBuffers();
6579:                                                 oslWaitVSync();
6580:                                             }
6581:                                         creepypasta(i);
6582:                                         vies--;
6583:                                     }
6584:                                     else
6585:                                     {
6586:                                         vies=-1;
6587:                                     }
6588:                                 }
6589:                                 else
6590:                                 {
6591:                                     fadeout();
6592:                                     if (round==1) ben();
6593:                                     round++;
6594:                                 }
6595:                                 if ((vies > 0) && (round < 3))
6596:                                 {
6597:                                     taunt(random(12));
6598:                                 }
6599:                             }
6600: 
6601:                             break;
6602:                         }
6603: 
6604:                         case 1:
6605:                         {
6606:                             chd++;
6607:                             break;
6608:                         }
6609: 
6610:                         case 2:
6611:                         {
6612:                             f=-1;
6613:                             oslStopSound(theme);
6614: 
6615: 
6616:                             h=100;
6617:                            
6618:                             credz();
6619: 
6620:                             /*if (DEBUG)
6621:                             {
6622:                                 sonicexe(chd+1);
6623:                             }
6624:                             else
6625:                             {
6626:                                 credz();
6627:                             }*/
6628:                             break;
6629:                         }
6630: 
6631:                         case 3:
6632:                         {
6633:                             ch=137;
6634:                             quit=1;
6635:                             break;
6636:                         }
6637:                     }
6638:             }
6639:             oslEndDrawing();
6640:             oslSwapBuffers();
6641:             oslWaitVSync();
6642:         }
6643:    }
6644: 
6645:    fadeout();
6646:    al_show_mouse_cursor(display);
6647:    al_destroy_display(display);
6648:  
6649:    return 0;
6650: }