Ejemplo n.º 1
0
void
QuarkProcessVSAVSprites(GGPOSession *ggpo, QuarkSprite sprites[], int count)
{   
   static const struct {
      char *character;
      int  id;
   } search[] = {
      {"Demitri",      15594 },
      {"Morrigan",     15544 },
      {"Victor",       15550 },
      {"B.B.Hood",     15539 },
      {"Q-Bee",        15610 },
      {"Lilith",       15564 },
      {"L.Rapter",     15501 },
      {"Felicia",      15562 },
      {"Jedah",        15726 },
      {"J.Talbain",    15533 },
      {"Bishamon",     15547 },
      {"Anakaris",     15578 },
      {"Hsien-Ko",     15597 },
      {"Sasquatch",    15768 },
      {"Rikuo",        15694 },
   };

   static const QuarkSpriteInfo finishSprite = { 64928, 104, 88 };
   static const QuarkSpriteInfo startSprite = { 46365, 168, 104 };
   /*
    * See if it's time to start a new game...
    */
   if (GameInfo.state == STATE_IDLE) {
      if (SpriteInList(&startSprite, sprites, count)) {
         GameInfo.state = STATE_STARTING;
      }
   } else if (GameInfo.state == STATE_STARTING) {
      if (!SpriteInList(&startSprite, sprites, count)) {
         QuarkSpriteStartNewGame(ggpo, "vsav");
         GameInfo.state = STATE_RUNNING;
      }
   } else if (GameInfo.state == STATE_RUNNING) {
      /*
       * We can go from running back to starting if someone
       * does something weird like resetting the game.  So keep
       * looking for the start sprite.
       */
      if (SpriteInList(&startSprite, sprites, count)) {
         GameInfo.state = STATE_STARTING;
      }

      /*
      * Identify the players...
      */
      if (!GameInfo.p[0].id || !GameInfo.p[1].id) {
         for (int j = 0; j < _ARRAYSIZE(search); j++) {
            for (int k = 0; k < count; k++) {
               if (sprites[k].id == search[j].id && sprites[k].y == 24) {
                  if (sprites[k].x < 160) {
                     GameInfo.p[0].id = search[j].character;
                  } else {
                     GameInfo.p[1].id = search[j].character;
                  }
               }
            }
         }
      }

      /*
       * See if we're finished...
       */
      if (SpriteInList(&finishSprite, sprites, count)) {
         GameInfo.p[0].rounds = 0;
         GameInfo.p[1].rounds = 0;
         for (int k = 0; k < count; k++) {
            if (sprites[k].y == 23) {
               if (sprites[k].x == 8 || sprites[k].x == 34) {
                  GameInfo.p[0].rounds++;
               } else if (sprites[k].x == 328 || sprites[k].x == 354) {
                  GameInfo.p[1].rounds++;
               }
            }
         }

         QuarkSpriteFinishGame(ggpo);
         GameInfo.state = STATE_IDLE;
      }
   }
}
Ejemplo n.º 2
0
void
QuarkProcessMVSCSprites(GGPOSession *ggpo, QuarkSprite sprites[], int count)
{   
  /*
   * P1, Round 1:  17x 28 (blank: 42016)
   * P1, Round 2:  32x 28 
   * P2, Round 2: 336x 28
   * P2, Round 1: 352x 28
   *
   *       {"Ryu: 109x29 (3x1) 
   */

   /*
    * These are the nameplates for all the characters you can select.
    */
   static const struct {
      char *character;
      int id;
   } search[] = {
      {"Roll",             28092 },
      {"Roll",             28245 },
      {"Ryu",              28094 },
      {"Ryu",              28247 },
      {"Chun Li",          28120 },
      {"Chun Li",          28264 },
      {"Zangief",          28320 },
      {"Zangief",          28268 },
      {"Morrigan",         28280 },
      {"Morrigan",         28336 },
      {"Captain Commando", 28112 },
      {"Captain Commando", 28256 },
      {"Megaman",          28124 },
      {"Megaman",          28344 },
      {"Strider-Hiryu",    28104 },
      {"Strider-Hiryu",    28249 }, 
      {"Spiderman",        28240 },
      {"Spiderman",        28099 },
      {"Jin",              28278 },
      {"Jin",              28332 },
      {"Captain America",  28144 },
      {"Captain America",  28080 },
      {"Hulk",             28138 },
      {"Hulk",             28077 },
      {"Venom",            28074 },
      {"Venom",            28156 },
      {"War Machine",      28069 },
      {"War Machine",      28133 },
      {"Gambit",           28096 },
      {"Gambit",           28140 },
      {"Wolverine",        28087 },
      {"Wolverine",        28151 },
   };

   static const QuarkSpriteInfo startSprite =  { 46614, 136, 0 };
   static const QuarkSpriteInfo finishSprite = { 59888, 128, 128 }; 

   /*
    * See if it's time to start a new game...
    */
   if (GameInfo.state == STATE_IDLE) {
      if (SpriteInList(&startSprite, sprites, count)) {
         GameInfo.state = STATE_STARTING;
      }
   } else if (GameInfo.state == STATE_STARTING) {
      if (!SpriteInList(&startSprite, sprites, count)) {
         QuarkSpriteStartNewGame(ggpo, "mvsc");
         GameInfo.state = STATE_RUNNING;
      }
   } else if (GameInfo.state == STATE_RUNNING) {
      /*
       * We can go from running back to starting if someone
       * does something weird like resetting the game.  So keep
       * looking for the start sprite.
       */
      if (SpriteInList(&startSprite, sprites, count)) {
         GameInfo.state = STATE_STARTING;
      }

      /*
       * Identify the players...
       */
      for (int i = 0; i < 2; i++) {
         for (int j = 0; j < 2; j++) {
            if (!GameInfo.p[i].c[j]) {
               for (int k = 0; k < ARRAYSIZE(search); k++) {
                  for (int l = 0; l < count; l++) {
                     if (sprites[l].id == search[k].id) {
                        if (i == 0 && j == 0 && sprites[l].x == 40 && sprites[l].y == 14) {
                           GameInfo.p[i].c[j] = search[k].character;
                        } else if (i == 0 && j == 1 && sprites[l].x == 40 && sprites[l].y == 37) {
                           GameInfo.p[i].c[j] = search[k].character;
                        } else if (i == 1 && j == 0 && (sprites[l].x + sprites[l].w == 344) && sprites[l].y == 14) {
                           GameInfo.p[i].c[j] = search[k].character;
                        } else if (i == 1 && j == 1 && (sprites[l].x + sprites[l].w == 344) && sprites[l].y == 37) {
                           GameInfo.p[i].c[j] = search[k].character;
                        }
                     }
                  }
               }
            }
         }
      }
      /*
       * See if we're finished...
       */
      if (SpriteInList(&finishSprite, sprites, count)) {
         static const QuarkSpriteInfo p1win =  { 27712, 48, 2};
         if (SpriteInList(&p1win, sprites, count)) {
            GameInfo.p[0].rounds = 1;
         } else {
            GameInfo.p[1].rounds = 1;
         }
         QuarkSpriteFinishGame(ggpo);
         GameInfo.state = STATE_IDLE;
      }
   }
}