コード例 #1
0
static int global_physics_update (lua_State *L)
{
TRY_START
        check_args(L, 0);
        physics_update(L);
        return 0;
TRY_END
}
コード例 #2
0
ファイル: physics.cpp プロジェクト: blezek/marathon-ios
void update_player_physics_variables(
	short player_index,
	uint32 action_flags,
	bool predictive)
{
	struct player_data *player= get_player_data(player_index);
	struct physics_variables *variables= &player->variables;
	struct physics_constants *constants= get_physics_constants_for_model(static_world->physics_model, action_flags);

	physics_update(constants, variables, player, action_flags);
	instantiate_physics_variables(constants, variables, player_index, false, !predictive);

#ifdef DIVERGENCE_CHECK
	if (saved_point_count<SAVED_POINT_COUNT)
	{
		struct object_data *object= get_object_data(get_monster_data(player->monster_index)->object_index);
		world_point3d p= object->location;
		world_point3d *q= saved_points+saved_point_count;
		angle *facing= saved_thetas+saved_point_count;
		
		if (saved_point_iterations==1)
		{
			saved_points[saved_point_count]= p;
			*facing= object->facing;
		}
		else
		{
			if (p.x!=q->x||p.y!=q->y||p.z!=q->z||*facing!=object->facing&&!saved_divergence_warning)
			{
				dprintf("divergence @ tick %d: (%d,%d,%d,%d)!=(%d,%d,%d,%d)", saved_point_count,
					q->x, q->y, q->z, *facing, p.x, p.y, p.z, object->facing);
				saved_divergence_warning= true;
			}
		}
		
		saved_point_count+= 1;
	}
#endif
}
コード例 #3
0
int main(void)
{
	physics_init(LCD_WIDTH, LCD_HEIGHT);
	input_init();
	display_init();
	segment_init();
	players_init();
	
	playerA = players_get(0);
	playerB = players_get(1);
	
	ball = physics_create(LCD_WIDTH / 2, LCD_HEIGHT / 2, BALL_RADIUS, BALL_MASS);
	
	for (;;)
	{
		input_update();
		players_update(0.01f);
		physics_update(0.01f);
		game_update();
		game_draw();
	}
	
	return 0;
}
コード例 #4
0
ファイル: simulator.cpp プロジェクト: tiagoapimenta/walksim
void Simulator::update(double time)
{
	physics_update(time);
}
コード例 #5
0
ファイル: core.c プロジェクト: fbidu/data-structures
void core_update(int timeStep) {
    physics_update(gCore.tree, gCore.entities);
}
コード例 #6
0
ファイル: main.c プロジェクト: attente/eofsim
int
main (int argc, char **argv)
{
  net_addr remote;
  int serial;
  int net;

  graphics_initialise ();
  graphics_mode (0);

  serial = serial_open ();
  net = net_open ();

  if (argc != 1)
  {
    if (argc != 2)
    {
      fprintf (stderr, "only 1 or 0 args\n");
      return 1;
    }

    if (strcmp (argv[1], "--final"))
    {
      fprintf (stderr, "unrecognised option\n");
      return 1;
    }
  }
  else
    randomised = true;

  printf ("randomised: %d\n", randomised);

  while (serial_ready (serial))
    serial_discard (serial);
  net_addr_set (&remote, "10.0.0.2");

  while (true)
  {
    bool ended;

    /* wait for user */
    reset_the_physics (true);
    publish_the_physics (serial, net, &remote);
    graphics_render (0, 0);

    while (!serial_ready (serial))
      check_sdl ();

    reset_the_physics (false);
    ended = false;
    while (!ended)
    {
      serial_read (serial);
      poll (NULL, 0, 10);
      ended = physics_update ();
      publish_the_physics (serial, net, &remote);
      check_sdl ();
      graphics_render (0, 0);
    }

    while (check_sdl () != ' ')
      poll (NULL, 0, 10);

    while (serial_ready (serial))
      serial_read (serial);
  }
}
コード例 #7
0
ファイル: game.c プロジェクト: rolfrm/Galaglitch
void game_iteration(controller controller, float dt, game_data * gd){
  physics_update(gd, dt);
  ai_update(gd, dt);
  player_update(gd, controller, dt);
}