Exemplo n.º 1
0
Arquivo: player.c Projeto: krig/roam
void player_tick(float dt)
{
	// update script vars
	pv.accel = script_get("player.accel");
	pv.friction = script_get("player.friction");
	pv.gravity = script_get("player.gravity");
	pv.flyspeed = script_get("player.flyspeed");
	pv.flyfriction = script_get("player.flyfriction");
	pv.height = script_get("player.height");
	pv.crouchheight = script_get("player.crouchheight");
	pv.camoffset = script_get("player.camoffset");
	pv.crouchcamoffset = script_get("player.crouchcamoffset");
	pv.jumpspeed = script_get("player.jumpspeed");

	struct player *p = &game.player;
	// update animations
	p->crouch_fade = m_clamp(p->crouch_fade + (p->crouching?dt:-dt)*5.f, 0.f, 1.f);
	++game.player.bobcount;
	if (game.player.bobcount > 200)
		game.player.bobcount = 0;


	if (game.camera.mode == CAMERA_FLIGHT) {
		flight_move(p, dt);
		return;
	} else if (game.camera.mode == CAMERA_FPS) {
		fps_move(p, dt);
	}

	p->prev_chunk = p->chunk;
	p->prev_block = p->block;
	p->prev_pos = p->pos;
	p->prev_vel = p->vel;
}
Exemplo n.º 2
0
/*
 * ":py3"
 */
void
ex_py3(exarg_T *eap)
{
	char_u *script;

	script = script_get(eap, eap->arg);
	if (!eap->skip) {
		DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
					(rangeinitializer) init_range_cmd,
					(runner) run_cmd,
					(void *) eap);
	}
	vim_free(script);
}
Exemplo n.º 3
0
Arquivo: if_python.c Projeto: aosm/vim
/*
 * ":python"
 */
    void
ex_python(exarg_T *eap)
{
    char_u *script;

    script = script_get(eap, eap->arg);
    if (!eap->skip)
    {
	if (script == NULL)
	    DoPythonCommand(eap, (char *)eap->arg);
	else
	    DoPythonCommand(eap, (char *)script);
    }
    vim_free(script);
}
Exemplo n.º 4
0
void ex_ruby(exarg_T *eap)
{
    int state;
    char *script = NULL;

    script = (char *)script_get(eap, eap->arg);
    if (!eap->skip && ensure_ruby_initialized())
    {
	if (script == NULL)
	    rb_eval_string_protect((char *)eap->arg, &state);
	else
	    rb_eval_string_protect(script, &state);
	if (state)
	    error_print(state);
    }
    vim_free(script);
}