Rollback et reprise de refact Game et debug
This commit is contained in:
parent
0a88a5cbc4
commit
59670adf77
Binary file not shown.
13
src/inputs.c
13
src/inputs.c
|
@ -7,8 +7,8 @@
|
|||
#ifdef FXCG50
|
||||
|
||||
//The actual keys behind the RCKEY_ ones
|
||||
uint8_t keymap = [0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ALPHA,
|
||||
KEY_SHIFT, KEY_F6, KEY_F1, KEY_TAN];
|
||||
uint8_t keymap = {0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ALPHA,
|
||||
KEY_SHIFT, KEY_F6, KEY_F1, KEY_TAN};
|
||||
|
||||
void rc_pollevent() {
|
||||
pollevent();
|
||||
|
@ -33,9 +33,9 @@ uint8_t rc_keydown(enum keys key) {
|
|||
// F1 = FPS counter
|
||||
// G = Debug
|
||||
|
||||
uint8_t keymap = [0, SDL_SCANCODE_W, SDL_SCANCODE_S, SDL_SCANCODE_Q, SDL_SCANCODE_D,
|
||||
uint8_t keymap = {0, SDL_SCANCODE_W, SDL_SCANCODE_S, SDL_SCANCODE_Q, SDL_SCANCODE_D,
|
||||
SDL_SCANCODE_SPACE, SDL_SCANCODE_F, SDL_SCANCODE_ESCAPE,
|
||||
SDL_SCANCODE_F1, SDL_SCANCODE_G];
|
||||
SDL_SCANCODE_F1, SDL_SCANCODE_G};
|
||||
|
||||
SDL_Event sdl_events;
|
||||
|
||||
|
@ -51,7 +51,10 @@ uint8_t rc_keydown(enum keys key){
|
|||
|
||||
#endif
|
||||
|
||||
void keys_get(ShooterMap *ShooterLevel, Player *player){
|
||||
void keys_get(Game *game){
|
||||
Player *player = &game->player;
|
||||
ShooterMap *shooterLevel = game->shooterLevel;
|
||||
|
||||
extern char screenshot;
|
||||
extern char record;
|
||||
extern char capture_timer;
|
||||
|
|
|
@ -18,4 +18,4 @@ enum keys {
|
|||
|
||||
};
|
||||
|
||||
void keys_get(ShooterMap *ShooterLevel, Player *player);
|
||||
void keys_get(Game *game);
|
||||
|
|
36
src/main.c
36
src/main.c
|
@ -36,8 +36,6 @@
|
|||
#error "Ce code n'est pas pour FX, enlevez ce message a vos riques et périls"
|
||||
#endif
|
||||
|
||||
extern ShooterMap ShooterLevel0;
|
||||
|
||||
extern image_t briques0;
|
||||
extern image_t buisson0;
|
||||
|
||||
|
@ -68,8 +66,6 @@ int main(){
|
|||
|
||||
//trucs de chargement
|
||||
|
||||
load_map();
|
||||
|
||||
image_t *vram = image_create_vram();
|
||||
image_t *sky_tex = image_alloc(64, 64, IMAGE_RGB565);
|
||||
image_t *WXOR_tex = image_alloc(64, 64, IMAGE_RGB565);
|
||||
|
@ -96,17 +92,22 @@ int main(){
|
|||
|
||||
prof_init();
|
||||
|
||||
player1.pos.x = fix(3);
|
||||
player1.pos.y = fix(3);
|
||||
player1.pos.z = fix(0);
|
||||
player1.velocity.x = 0;
|
||||
player1.velocity.y = 0;
|
||||
player1.velocity.z = 0;
|
||||
player1.dir.x = 0xFFFF;
|
||||
player1.dir.y = 0x0;
|
||||
player1.plane.x = 0x0;
|
||||
player1.plane.y = fix(-0.66F);
|
||||
player1.speed_mult = 0xFFFF;
|
||||
Game game;
|
||||
Player player;
|
||||
game.player = &player;
|
||||
load_map(&game, 0);
|
||||
|
||||
player.pos.x = fix(3);
|
||||
player.pos.y = fix(3);
|
||||
player.pos.z = fix(0);
|
||||
player.velocity.x = 0;
|
||||
player.velocity.y = 0;
|
||||
player.velocity.z = 0;
|
||||
player.dir.x = 0xFFFF;
|
||||
player.dir.y = 0x0;
|
||||
player.plane.x = 0x0;
|
||||
player.plane.y = fix(-0.66F);
|
||||
player.speed_mult = 0xFFFF;
|
||||
|
||||
while (exit_game == 0) {
|
||||
prof_t frame = prof_make();
|
||||
|
@ -116,11 +117,11 @@ int main(){
|
|||
|
||||
//draw_sprites(&zombard, &ShooterLevel0, &player1);
|
||||
|
||||
draw_walls(&ShooterLevel0, &player1, vram);
|
||||
draw_walls(&game, vram);
|
||||
|
||||
//if(first_frame == 1) main_menu();
|
||||
|
||||
keys_get(&ShooterLevel0, &player1);
|
||||
keys_get(&game);
|
||||
|
||||
//logic();
|
||||
|
||||
|
@ -157,6 +158,7 @@ int main(){
|
|||
usb_close();
|
||||
#endif
|
||||
|
||||
image_free(vram);
|
||||
image_free(sky_tex);
|
||||
image_free(WXOR_tex);
|
||||
image_free(D_tex);
|
||||
|
|
34
src/moteur.c
34
src/moteur.c
|
@ -60,7 +60,10 @@ int8_t bumps_head(ShooterMap *ShooterLevel, Vector3d pos) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void move(ShooterMap *ShooterLevel, Player *player) {
|
||||
void move(Game *game) {
|
||||
Player *player = &game->player;
|
||||
ShooterMap *shooterLevel = game->shooterLevel;
|
||||
|
||||
extern int frame_time;
|
||||
fixed_t sFrameTime = fix(frame_time)/1000; //Frame time in seconds
|
||||
fixed_t moveSpeed = fmul(sFrameTime, 20*player->speed_mult); //frame_time * fix(carrés/seconde là carrés/seconde = 5
|
||||
|
@ -139,7 +142,7 @@ void move(ShooterMap *ShooterLevel, Player *player) {
|
|||
if (player->dir.y < -0xFFFF) player->dir.y = -0xFFFF;
|
||||
}
|
||||
|
||||
void draw_background(int background_id){ //a refaire
|
||||
void draw_background(int back_id){ //a refaire
|
||||
|
||||
}
|
||||
|
||||
|
@ -147,18 +150,26 @@ void logic(){
|
|||
//logique (logique)
|
||||
}
|
||||
|
||||
void load_map(){
|
||||
void load_map(Game *game, int map_id){
|
||||
extern ShooterMap ShooterLevel0;
|
||||
|
||||
dtext( 1, 1, C_BLACK, "Chargement...");
|
||||
dupdate();
|
||||
//trucs de map
|
||||
|
||||
switch(map_id){
|
||||
case 0:{game->shooterLevel = &ShooterLevel0; break;}
|
||||
default:{game->shooterLevel = &ShooterLevel0; break;}
|
||||
}
|
||||
}
|
||||
|
||||
void draw_f(image_t *floor_tex){ //a refaire
|
||||
void draw_f(image_t *vram){ //a refaire
|
||||
|
||||
}
|
||||
|
||||
void draw_walls(ShooterMap *ShooterLevel, Player *player, image_t *vram){
|
||||
unsigned short color;
|
||||
void draw_walls(Game *game, image_t *vram){
|
||||
Player *player = &game->player;
|
||||
ShooterMap *shooterLevel = game->shooterLevel;
|
||||
|
||||
fixed_t cameraX;
|
||||
fixed_t rayDirX;
|
||||
fixed_t rayDirY;
|
||||
|
@ -316,7 +327,7 @@ void draw_walls(ShooterMap *ShooterLevel, Player *player, image_t *vram){
|
|||
texSample = tsize - texSampleY;
|
||||
linePos = 2;
|
||||
}
|
||||
if (linePos > viewport_h) {
|
||||
else if (linePos > viewport_h) {
|
||||
texSampleY = texSize*abs(linePos);
|
||||
texSample = tsize - texSampleY;
|
||||
linePos = viewport_h;
|
||||
|
@ -324,14 +335,15 @@ void draw_walls(ShooterMap *ShooterLevel, Player *player, image_t *vram){
|
|||
else {
|
||||
texSampleY = 0;
|
||||
}
|
||||
dclear(C_WHITE); dprint(1,1,C_BLACK,"coucou 327"); dupdate(); getkey();
|
||||
|
||||
tex_stripe = image_sub(tex_index[tex], texX, texSampleY, 1, texSample);
|
||||
|
||||
image_scale(tex_stripe, 0xFFFF, texSize, &temp);
|
||||
|
||||
image_linear(tex_stripe, image_at(vram, x, linePos), &temp); //Plante ici
|
||||
//image_linear(tex_stripe, image_at(vram, x, linePos), &temp); //Plante ici
|
||||
|
||||
gint_dvline(linePos, linePos+lineHeight, x, 0xFAFA);
|
||||
|
||||
//dline(x, linePos, x, linePos+lineHeight, 0xFAFA);
|
||||
prof_leave(img_drw);
|
||||
prof_enter(rayscat);
|
||||
}
|
||||
|
|
12
src/moteur.h
12
src/moteur.h
|
@ -14,13 +14,11 @@ static inline uint8_t has_collision(uint8_t tile){
|
|||
}
|
||||
}
|
||||
|
||||
void draw_background(int);
|
||||
void load_map();
|
||||
void draw_background(int back_id);
|
||||
void load_map(Game *game, int map_id);
|
||||
void logic();
|
||||
void draw_f(image_t*);
|
||||
void init_stripes();
|
||||
void free_stripes();
|
||||
void draw_walls(ShooterMap*, Player*, image_t*);
|
||||
void move(ShooterMap*, Player*);
|
||||
void draw_f(image_t *vram);
|
||||
void draw_walls(Game *game, image_t *vram);
|
||||
void move(Game *game);
|
||||
|
||||
#endif /* moteur */
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "includes.h"
|
||||
|
||||
#ifdef SDL2
|
||||
|
||||
#define window_w screen_w*upscale
|
||||
#define window_h screen_h*upscale
|
||||
|
||||
|
@ -22,3 +24,5 @@ void sdl_image_quit(SDL_Window *window){
|
|||
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -63,9 +63,9 @@ typedef struct{
|
|||
|
||||
typedef struct{
|
||||
|
||||
ShooterMap *ShooterLevel;
|
||||
ShooterMap *shooterLevel;
|
||||
|
||||
Player *Player;
|
||||
Player *player;
|
||||
|
||||
int level;
|
||||
|
||||
|
|
Loading…
Reference in New Issue