From bf0d6f7a05d3674552a1a93b8aba99804c216672 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 23 May 2023 12:38:21 +0200 Subject: [PATCH] move striker gen to animations.c --- includes/animations.h | 10 ++++++++++ src/animations.c | 14 ++++++++++++++ src/manif.c | 18 +----------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/includes/animations.h b/includes/animations.h index 18fa775..b63242e 100644 --- a/includes/animations.h +++ b/includes/animations.h @@ -23,4 +23,14 @@ void transitions_init(void); // Transition zoom void zoom_in(void (*)(int), void (*)(int), Uint32, Uint32, int); +// Personnage +struct manifestant { + GLuint corps, tete, jambe_g, jambe_d, bras_g, bras_d; + // Offsets + GLfloat ox, oz; +}; + +// Génère un manifestant +void genManifestant(struct manifestant *); + #endif diff --git a/src/animations.c b/src/animations.c index c260bec..f780f5f 100644 --- a/src/animations.c +++ b/src/animations.c @@ -109,3 +109,17 @@ static void zoomin_deinit(void) { _zoomin_tex[0] = _zoomin_tex[1] = 0; } } + +void genManifestant(struct manifestant *hero) { + // Head and body + hero->tete = gl4dgGenSpheref(7, 7); + hero->corps = gl4dgGenCubef(); + + // Arms + hero->bras_d = gl4dgGenCubef(); + hero->bras_g = gl4dgGenCubef(); + + // Legs + hero->jambe_g = gl4dgGenCubef(); + hero->jambe_d = gl4dgGenCubef(); +} diff --git a/src/manif.c b/src/manif.c index fe5a873..d19a58e 100644 --- a/src/manif.c +++ b/src/manif.c @@ -3,12 +3,6 @@ static GLuint _pId = 0; static GLuint _planId = 0; -struct manifestant { - GLuint corps, tete, jambe_g, jambe_d, bras_g, bras_d; - // Offsets - GLfloat ox, oz; -}; - #define HEROS_NUMBER 30 // should change in fragment shader too static struct manifestant _herosId[HEROS_NUMBER]; @@ -39,17 +33,7 @@ static void init(void) { // Last Offset X and Z for (int i = 0; i < HEROS_NUMBER; ++i) { - // Head and body - _herosId[i].tete = gl4dgGenSpheref(7, 7); - _herosId[i].corps = gl4dgGenCubef(); - - // Arms - _herosId[i].bras_d = gl4dgGenCubef(); - _herosId[i].bras_g = gl4dgGenCubef(); - - // Legs - _herosId[i].jambe_g = gl4dgGenCubef(); - _herosId[i].jambe_d = gl4dgGenCubef(); + genManifestant(&_herosId[i]); // Coordinates _herosId[i].ox = ((GLfloat)rand() / (GLfloat)RAND_MAX) * -50;