Ejemplo n.º 1
0
void rt_initialize() {
  rpcmsg msg;

  reset_object();
  reset_lights();
  InitTextures();

  if (!parinitted) {
    parinitted=1;

    msg.type=1; /* setup a ping message */
  }
}
Ejemplo n.º 2
0
///  constructor 
Scene::Scene() : root(this) {
  set_background_mode(0);
  reset_lights();

  // initialize color names and values
  int i;
  for (i=BEGREGCLRS; i<REGCLRS; i++) {
    colorNames.add_name(defColorNames[i], i);
    set_color_value(i, defaultColor + 3*i);
  }
  //initialize color scale info
  for (i=0; i<num_scalemethods; i++) 
    colorScales.append(defScales[i]);
  scaleMethod = 0;
  scaleMin = 0.1f;
  scaleMax = 1.0f;
  scaleMid = 0.5f;
  create_colorscale();

  // background color 
  background = new DisplayColor(&root, "Background", REGBLACK);
  background_color_changed = 0;
  background_color_id = 0;

  // background gradient colors
  backgradtop = new DisplayColor(&root, "BackgroundTop", REGBLACK);
  backgradtop_color_changed = 0;
  backgradtop_color_id = 0;
  backgradbot = new DisplayColor(&root, "BackgroundBot", REGBLUE2);
  backgradbot_color_changed = 0;
  backgradbot_color_id = 0;

  // foreground color
  foreground = new DisplayColor(&root, "Foreground", REGWHITE);
  foreground_color_changed = 0;
  foreground_color_id = 0;
}
Ejemplo n.º 3
0
void game_loop(void)
{
 int playing = 1;
 
 counter = 0;

 do
 {
  if (player[0].link_toggle_delay > 0)
    player[0].link_toggle_delay --;
  if (player[1].link_toggle_delay > 0)
    player[1].link_toggle_delay --;

  reset_lights();  
  get_input();
  enact_commands();
  run_actors();
  run_bullets(); // should be between actors and enemies for orbitals to work
  arena.waver_on_level = 0;
  run_clouds();
//  run_stars();
  run_enemies();
  run_pickups();
  play_beats();
  if (counter % 35 == 0)
   run_level();
  if (arena.game_over > 0)
  {
   arena.game_over --;
   if (arena.game_over == 1)
   {
    playing = 0;
    kill_gameover_loop();
   } 
   if (arena.game_over == 120)
    play_gameover_loop(1000);
  } else
   {
    if (arena.new_level_sign > 0)
     arena.new_level_sign --;
    if (arena.time_left > 0)
    {
     if (game.type != GAME_DUEL
       || (game.duel_mode != DUEL_10_POINTS && game.duel_mode != DUEL_30_POINTS))
     arena.time_left --;
     if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
      game.ta_total_time ++;
    }
      else
      {
       if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP)
       {
         arena.game_over = 132;
         hurt_actor(0, 0, 100000);
         hurt_actor(1, 0, 100000);
         // it's okay to call hurt_actor on non-existent actors.
       }
       if (game.type == GAME_DUEL)
       {
        if (arena.game_over == 0)
        {
         arena.game_over = 132;
         game.duel_winner = -1;
         if (player[0].duel_score > player[1].duel_score)
          game.duel_winner = 0;
         if (player[1].duel_score > player[0].duel_score)
          game.duel_winner = 1;
        }
       }
        else
        {
         if (arena.level_finished == 1)
         {
          if (arena.level == 15)
          {
           arena.level = 16;
//           play_gameover_loop(2200);
//           play_wavf(NWAV_SWARBLE, 1500);
           playing = 0;
           break;
          }
          init_level();
          if (actor[0].in_play == 1)
           actor_new_level(0);
          if (actor[1].in_play == 1)
           actor_new_level(1);
          ticked = 0;
         }
         else
         {
          if (arena.hostile == 0)
          {
           make_arena_hostile();
          }
           else
            {
             if (arena.hostile < 10000)
              arena.hostile ++;
             run_hostile_level();
            }
         }
        }
      }
/*    if (arena.time_left == 334)
    {
     send_message(0, "Hurry} Up}!", STYLE_HURRY);
     send_message(1, "Hurry} Up}!", STYLE_HURRY);
    }*/
    if (arena.time_left == 330 && (game.type != GAME_DUEL
       || (game.duel_mode != DUEL_10_POINTS && game.duel_mode != DUEL_30_POINTS)))
     play_wavf(NWAV_ALARM, 900);
    
    if (arena.hostile == 10 || arena.hostile == 40 || arena.hostile == 70)
     play_wavf(NWAV_ALARM, 700);

     
   }
   
  if (ticked == 0)
  {
   run_display();
   framecounter++;
  }
  
  init_effects();

  slacktime = 0;
  
  do
  {
   slacktime ++;
  } while(ticked == 0);
  ticked --;

  counter ++;
  
  if (counter % 32 == 0)
  {
   long_slacktime_store = long_slacktime;
   long_slacktime = 0;
  } 
   
   long_slacktime += slacktime / 100;
  

  if (key [KEY_ESC])
   quit_query();
  
 } while(playing == 1);

}