1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
| MNS_Camera_Perspective(camera);
event = MNS_Evenement();
if(event.touche[27] == 1) system->game = -1;
if(event.touche[GLUT_KEY_F3 + 255] == 2) fullscreen = !fullscreen;
MNS_Fenetre(800,600,fullscreen);
MNS_Fenetre_redimension(&camera.radio);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(type == 0)
{
if(event.touche[' '] == 2)
{
type = 1;
}
if(system->trs == 0)
gameplay(event,&camera,&camcfg,&hero);
}else
{
for(i = 0;i < 10;i++)
touche[i] = 0;
if(event.touche['w'] == 1) touche[0] = 1;
if(event.touche['c'] == 1) touche[0] = 2;
if(event.touche['s'] == 1) touche[2] = 2;
if(event.touche['x'] == 1) touche[2] = 1;
if(event.touche[system->touche[3]] == 1) touche[1] = 1;
if(event.touche[system->touche[4]] == 1) touche[1] = 2;
MNS_camera_vue_sub(&camera,&camcfg.angle,0.1,touche);
if(event.touche[' '] == 2)
{
type = 0;
camcfg.angle.x = 0;
camcfg.angle.y = 0.75;
camcfg.angle.z = 2;
}
}
if(system->trs == 0)
if(event.touche[system->touche[2]] == 2)
{
system->trs = 2;
Mix_PlayChannel(0, system->son[6], 0);
}
float hitbox = 0.12;
collision_map(map,&hero.position,&hero.vitesse);
system->zone = map.obj[0]->ng;
deplacement(&hero);
//---------------------------------
affichage_ciel(camcfg.angle.x,camcfg.angle.y,system->ciel);
affichage_map(camera,map);
affichage_perso(camera,hero);
game_fenetre(map,&hero,system);
if(pnj.magasin == 1)
magasin(system);
if(system->trs == 1)
{
if(alpha == 1)
gameplay(event,&camera,&camcfg,&hero);
affichage_transition(alpha);
alpha -= 0.05;
if(alpha <= 0)
{
alpha = 1;
system->trs =0;
}
hero.vitesse.x = 0;
hero.vitesse.z = 0;
hero.obj->n = 1;
}
if(system->trs == -1) system->trs = 0;
if(system->trs == 2)
{
affichage_transition(1-alpha);
alpha -= 0.05;
if(alpha <= 0)
{
alpha = 1;
system->trs =-1;
}
hero.vitesse.x = 0;
hero.vitesse.z = 0;
hero.obj->n = 1;
}
if(system->zone > 5)
{
random += fabs(hero.vitesse.x) + fabs(hero.vitesse.z);
if(random > 20 && rand() % 30 == 17)
{
fight(system,camera,hero);
random = 0;
}
}
if(event.touche[GLUT_KEY_F2 + 255] == 1)
fight(system,camera,hero);
if(event.touche[GLUT_KEY_F4 + 255] == 2)
{
system->zone = 20;
fight(system,camera,hero);
}
if(system->trs == -1)
{
system->camera = camcfg.angle;
system->zack = hero.status;
system->position = hero.position;
system->angle = hero.angle;
menu_game(system);
hero.status = system->zack;
hero.position = system->position;
hero.angle = system->angle;
camcfg.angle = system->camera;
}
glutSwapBuffers();
MNS_Fps(&t,30);
if(event.touche[GLUT_KEY_F1 + 255] == 2) MNS_imp_ecran("screen.bmp");
//editeur_map(&map,script); |