J'ai oublié de commit --'
|
@ -16,8 +16,11 @@ set(NAMEOFGAME "Test3D")
|
||||||
set(AUTHOR "Fcalva")
|
set(AUTHOR "Fcalva")
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
#sources de votre jeu
|
#sources du jeu
|
||||||
src/main.c
|
src/main.c
|
||||||
|
src/gfx.c
|
||||||
|
src/map.c
|
||||||
|
src/game.c
|
||||||
#sources du moteur
|
#sources du moteur
|
||||||
eng/moteur.c
|
eng/moteur.c
|
||||||
eng/map.c
|
eng/map.c
|
||||||
|
@ -27,15 +30,21 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
set(ASSETS
|
set(ASSETS
|
||||||
assets-fx/sprite.png
|
assets-fx/sprites/friendlyguy.png
|
||||||
|
assets-fx/sprites/friendlyguy1.png
|
||||||
|
|
||||||
assets-fx/textures/briques0.png
|
assets-fx/textures/briques0.png
|
||||||
assets-fx/textures/buisson1.png
|
assets-fx/textures/buisson1.png
|
||||||
|
assets-fx/textures/bwain.png
|
||||||
|
assets-fx/textures/bwain1.png
|
||||||
|
assets-fx/textures/meat.png
|
||||||
|
assets-fx/textures/meat1.png
|
||||||
)
|
)
|
||||||
|
|
||||||
fxconv_declare_assets(${ASSETS} WITH_METADATA)
|
fxconv_declare_assets(${ASSETS} WITH_METADATA)
|
||||||
|
|
||||||
add_executable(Copy3DEngine ${SOURCES} ${ASSETS})
|
add_executable(Copy3DEngine ${SOURCES} ${ASSETS})
|
||||||
target_compile_options(Copy3DEngine PRIVATE -Wall -Wextra -Ofast)
|
target_compile_options(Copy3DEngine PRIVATE -Wall -Wextra -O2)
|
||||||
target_include_directories(Copy3DEngine PRIVATE "include/")
|
target_include_directories(Copy3DEngine PRIVATE "include/")
|
||||||
target_compile_definitions(Copy3DEngine PRIVATE NAMEOFGAME="${NAMEOFGAME}" AUTHOR="${AUTHOR}")
|
target_compile_definitions(Copy3DEngine PRIVATE NAMEOFGAME="${NAMEOFGAME}" AUTHOR="${AUTHOR}")
|
||||||
target_link_libraries(Copy3DEngine Gint::Gint)
|
target_link_libraries(Copy3DEngine Gint::Gint)
|
||||||
|
|
BIN
assets-fx/2bpp_palette.png
Normal file
After Width: | Height: | Size: 77 B |
|
@ -1,4 +1 @@
|
||||||
sprite.png:
|
|
||||||
type: bopti-image
|
|
||||||
name: sprite_tst
|
|
||||||
profile: gray_alpha
|
|
||||||
|
|
Before Width: | Height: | Size: 642 B |
BIN
assets-fx/sprites/friendlyguy.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
assets-fx/sprites/friendlyguy1.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
8
assets-fx/sprites/fxconv-metadata.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
friendlyguy.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: sprite_tst
|
||||||
|
profile: gray_alpha
|
||||||
|
friendlyguy1.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: sprite_tst1
|
||||||
|
profile: gray_alpha
|
BIN
assets-fx/textures/bwain.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
assets-fx/textures/bwain1.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
|
@ -1,7 +1,21 @@
|
||||||
briques0.png:
|
briques0.png:
|
||||||
type: bopti-image
|
type: bopti-image
|
||||||
name: briques0
|
name: briques0
|
||||||
|
|
||||||
buisson1.png:
|
buisson1.png:
|
||||||
type: bopti-image
|
type: bopti-image
|
||||||
name: buisson0
|
name: buisson0
|
||||||
|
|
||||||
|
bwain.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: bwain0
|
||||||
|
bwain1.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: bwain1
|
||||||
|
|
||||||
|
meat.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: meat0
|
||||||
|
meat1.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: meat1
|
||||||
|
|
BIN
assets-fx/textures/meat.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
assets-fx/textures/meat1.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
66
eng/map.c
|
@ -5,69 +5,3 @@
|
||||||
#include "C3D/map.h"
|
#include "C3D/map.h"
|
||||||
#include "C3D/moteur.h"
|
#include "C3D/moteur.h"
|
||||||
|
|
||||||
uint8_t __attribute__((section(".rodata"))) map_test[map_w][map_h] = {
|
|
||||||
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3},
|
|
||||||
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3},
|
|
||||||
{1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,2,0,2,0,0,2,0,0,0,0,2,0,0,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3},
|
|
||||||
{1,0,0,0,1,0,1,0,0,0,0,0,0,0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,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1},
|
|
||||||
{1,0,2,2,0,2,0,1,1,0,1,0,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,0,1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,1,1,0,1,1,0,1},
|
|
||||||
{1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1},
|
|
||||||
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
|
|
||||||
};
|
|
||||||
|
|
13
eng/moteur.c
|
@ -27,8 +27,8 @@ fixed_t zbuf[viewport_w];
|
||||||
|
|
||||||
void move(RcGame *game) {
|
void move(RcGame *game) {
|
||||||
extern int frame_time;
|
extern int frame_time;
|
||||||
fixed_t moveSpeed = fmul(fix(frame_time)/1000, 0x148); //frame_time * fix(carrés/seconde/1000) là carrés/seconde = 5
|
fixed_t moveSpeed = fmul(fix(frame_time/1000), 0x148); //frame_time * fix(carrés/seconde/1000) là carrés/seconde = 5
|
||||||
fixed_t rotSpeed = fmul(fix(frame_time)/1000, 0x83); //frame_time * fix(radians/seconde/1000) là radians/seconde = 2
|
fixed_t rotSpeed = fmul(fix(frame_time/1000), 0x83); //frame_time * fix(radians/seconde/1000) là radians/seconde = 2
|
||||||
fixed_t c_rotSpeed = fix(cos(f2float(rotSpeed)));
|
fixed_t c_rotSpeed = fix(cos(f2float(rotSpeed)));
|
||||||
fixed_t s_rotSpeed = fix(sin(f2float(rotSpeed)));
|
fixed_t s_rotSpeed = fix(sin(f2float(rotSpeed)));
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ void move(RcGame *game) {
|
||||||
V2d *plane = &game->player.plane;
|
V2d *plane = &game->player.plane;
|
||||||
V2d *dir = &game->player.dir;
|
V2d *dir = &game->player.dir;
|
||||||
V2d *pos = &game->player.pos;
|
V2d *pos = &game->player.pos;
|
||||||
|
int map_w = game->current_map->w;
|
||||||
|
int map_h = game->current_map->h;
|
||||||
|
|
||||||
fixed_t oldDirX;
|
fixed_t oldDirX;
|
||||||
fixed_t oldPlaneX;
|
fixed_t oldPlaneX;
|
||||||
|
@ -116,7 +118,7 @@ inline int __attribute__((always_inline))
|
||||||
if(layers > 2){
|
if(layers > 2){
|
||||||
alpha = !(layer_ptr[2] & mask);
|
alpha = !(layer_ptr[2] & mask);
|
||||||
}
|
}
|
||||||
return (alpha << 2) + (dark << 1) + light;
|
return (alpha << 2) | (dark << 1) | light;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t *light, *dark;
|
uint32_t *light, *dark;
|
||||||
|
@ -151,6 +153,7 @@ inline void __attribute__((always_inline))
|
||||||
light[offset] |= mask;
|
light[offset] |= mask;
|
||||||
dark [offset] |= mask;
|
dark [offset] |= mask;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_NONE:
|
case C_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -221,7 +224,9 @@ void draw_walls(
|
||||||
fixed_t planeY = game->player.plane.y;
|
fixed_t planeY = game->player.plane.y;
|
||||||
extern bopti_image_t *tex_index[TINDEX_S];
|
extern bopti_image_t *tex_index[TINDEX_S];
|
||||||
uint8_t *map_test = game->current_map->dat;
|
uint8_t *map_test = game->current_map->dat;
|
||||||
|
int map_w = game->current_map->w;
|
||||||
|
int map_h = game->current_map->h;
|
||||||
|
|
||||||
fixed_t cameraX;
|
fixed_t cameraX;
|
||||||
fixed_t rayDirX;
|
fixed_t rayDirX;
|
||||||
fixed_t rayDirY;
|
fixed_t rayDirY;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <gint/gray.h>
|
#include <gint/gray.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "C3D/fixed.h"
|
#include "C3D/fixed.h"
|
||||||
#include "C3D/game.h"
|
#include "C3D/game.h"
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
|
|
||||||
extern fixed_t zbuf[viewport_w];
|
extern fixed_t zbuf[viewport_w];
|
||||||
|
|
||||||
int spritec;
|
int spritec = 0;
|
||||||
|
|
||||||
Sprite *sprite_index[SINDEX_S];
|
Sprite *sprite_index[SINDEX_S];
|
||||||
|
|
||||||
|
@ -30,8 +31,19 @@ void clear_sprites(){
|
||||||
spritec = 0;
|
spritec = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_sprite(GUNUSED Sprite *sprite){
|
void remove_sprite(Sprite *sprite){
|
||||||
//TODO
|
if(!sprite)
|
||||||
|
return;
|
||||||
|
int pos = -1;
|
||||||
|
for(int i = 0; i < spritec; i++){
|
||||||
|
if(sprite == sprite_index[i]){
|
||||||
|
pos = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pos < 0)
|
||||||
|
return;
|
||||||
|
memmove(&sprite_index[pos], &sprite_index[pos+1], sizeof(void*) * (spritec-pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Lodev's sprite projection, translated to use my functions and fixed point
|
//Lodev's sprite projection, translated to use my functions and fixed point
|
||||||
|
@ -77,7 +89,7 @@ void project_sprite(bopti_image_t *tex_index[], Sprite *sprite, RcActor *player)
|
||||||
fixed_t sprite_size = fdiv(fix(sprite_w), fix(TSIZE));
|
fixed_t sprite_size = fdiv(fix(sprite_w), fix(TSIZE));
|
||||||
|
|
||||||
for(int x = sprite_pos_x; x < sprite_end_x; x++){
|
for(int x = sprite_pos_x; x < sprite_end_x; x++){
|
||||||
if(ty < 0 || x < 0 || ty > zbuf[x])
|
if(ty < fix(0.4) || x < 0 || ty > zbuf[x])
|
||||||
continue;
|
continue;
|
||||||
if(x > viewport_w)
|
if(x > viewport_w)
|
||||||
break;
|
break;
|
||||||
|
@ -100,10 +112,10 @@ int sprite_cmpfnc(const void *p1, const void *p2){
|
||||||
void draw_sprites(bopti_image_t *tex_index[], RcActor *player){
|
void draw_sprites(bopti_image_t *tex_index[], RcActor *player){
|
||||||
struct SpriteDist dists[SINDEX_S];
|
struct SpriteDist dists[SINDEX_S];
|
||||||
memset(dists, 0, sizeof(struct SpriteDist)*SINDEX_S);
|
memset(dists, 0, sizeof(struct SpriteDist)*SINDEX_S);
|
||||||
|
|
||||||
for(int i = 0; i < spritec; i++){
|
for(int i = 0; i < spritec; i++){
|
||||||
Sprite *spr = sprite_index[i];
|
Sprite *spr = sprite_index[i];
|
||||||
fixed_t d = player->pos.x - spr->pos.x;
|
fixed_t d = fmul(player->pos.x - spr->pos.x, player->pos.x - spr->pos.x);
|
||||||
d = fmul(d,d);
|
|
||||||
d += fmul(player->pos.y - spr->pos.y,player->pos.y - spr->pos.y);
|
d += fmul(player->pos.y - spr->pos.y,player->pos.y - spr->pos.y);
|
||||||
dists[i].dist = d;
|
dists[i].dist = d;
|
||||||
dists[i].id = i;
|
dists[i].id = i;
|
||||||
|
@ -111,11 +123,12 @@ void draw_sprites(bopti_image_t *tex_index[], RcActor *player){
|
||||||
|
|
||||||
qsort(dists, SINDEX_S, sizeof(struct SpriteDist), &sprite_cmpfnc);
|
qsort(dists, SINDEX_S, sizeof(struct SpriteDist), &sprite_cmpfnc);
|
||||||
|
|
||||||
int msprite = min(spritec,max_sprites);
|
int msprite = spritec > max_sprites ? max_sprites:spritec;
|
||||||
for(int i = msprite; i > 0; i--){
|
for(int i = 0; i < msprite; i++){
|
||||||
struct SpriteDist *sd = &dists[i];
|
struct SpriteDist *sd = &dists[i];
|
||||||
Sprite *spr = sprite_index[sd->id];
|
Sprite *spr = sprite_index[sd->id];
|
||||||
if(sd->dist > max_dist)
|
|
||||||
|
if(sd->dist > max_dist || !spr)
|
||||||
continue;
|
continue;
|
||||||
project_sprite(tex_index, spr, player);
|
project_sprite(tex_index, spr, player);
|
||||||
}
|
}
|
||||||
|
@ -131,6 +144,8 @@ fixed_t raycast(RcGame *game, RcActor *origin, Sprite **hit){
|
||||||
fixed_t planeX = origin->plane.x;
|
fixed_t planeX = origin->plane.x;
|
||||||
fixed_t planeY = origin->plane.y;
|
fixed_t planeY = origin->plane.y;
|
||||||
uint8_t *map_test = game->current_map->dat;
|
uint8_t *map_test = game->current_map->dat;
|
||||||
|
int map_w = game->current_map->w;
|
||||||
|
int map_h = game->current_map->h;
|
||||||
|
|
||||||
fixed_t cameraX;
|
fixed_t cameraX;
|
||||||
fixed_t rayDirX;
|
fixed_t rayDirX;
|
||||||
|
@ -147,11 +162,8 @@ fixed_t raycast(RcGame *game, RcActor *origin, Sprite **hit){
|
||||||
int stepY;
|
int stepY;
|
||||||
int side = 0; //was a NS or a EW wall hit?
|
int side = 0; //was a NS or a EW wall hit?
|
||||||
|
|
||||||
//int v_offset = 0;
|
|
||||||
fixed_t h_offset = 0;
|
|
||||||
|
|
||||||
//calculate ray position and direction
|
//calculate ray position and direction
|
||||||
cameraX = fdiv(fix(x*2), fix(viewport_w)) - 0xFFFF + h_offset; //x-coordinate in camera space
|
cameraX = fdiv(fix(x*2), fix(viewport_w)) - 0xFFFF; //x-coordinate in camera space
|
||||||
|
|
||||||
rayDirX = dirX + fmul(planeX, cameraX);
|
rayDirX = dirX + fmul(planeX, cameraX);
|
||||||
rayDirY = dirY + fmul(planeY, cameraX);
|
rayDirY = dirY + fmul(planeY, cameraX);
|
||||||
|
|
78
eng/utils.c
|
@ -1,4 +1,82 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "C3D/fixed.h"
|
#include "C3D/fixed.h"
|
||||||
#include "C3D/game.h"
|
#include "C3D/game.h"
|
||||||
|
|
||||||
|
bool rect_rect_coll(Rect *a, Rect *b){
|
||||||
|
bool r = a->x0 >= b->x0 && a->x1 <= b->x1;
|
||||||
|
r = r && a->y0 >= b->y0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmpfunc (const void * a, const void * b) {
|
||||||
|
return ( *(int*)a - *(int*)b );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1990 Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. [rescinded 22 July 1999]
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Perform a binary search.
|
||||||
|
*
|
||||||
|
* The code below is a bit sneaky. After a comparison fails, we
|
||||||
|
* divide the work in half by moving either left or right. If lim
|
||||||
|
* is odd, moving left simply involves halving lim: e.g., when lim
|
||||||
|
* is 5 we look at item 2, so we change lim to 2 so that we will
|
||||||
|
* look at items 0 & 1. If lim is even, the same applies. If lim
|
||||||
|
* is odd, moving right again involes halving lim, this time moving
|
||||||
|
* the base up one item past p: e.g., when lim is 5 we change base
|
||||||
|
* to item 3 and make lim 2 so that we will look at items 3 and 4.
|
||||||
|
* If lim is even, however, we have to shrink it by one before
|
||||||
|
* halving: e.g., when lim is 4, we still looked at item 2, so we
|
||||||
|
* have to make lim 3, then halve, obtaining 1, so that we will only
|
||||||
|
* look at item 3.
|
||||||
|
*/
|
||||||
|
void *
|
||||||
|
bsearch (const void *key, const void *base0,
|
||||||
|
size_t nmemb, size_t size,
|
||||||
|
int (*compar)(const void *, const void *))
|
||||||
|
{
|
||||||
|
const char *base = (const char *) base0;
|
||||||
|
int lim, cmp;
|
||||||
|
const void *p;
|
||||||
|
|
||||||
|
for (lim = nmemb; lim != 0; lim >>= 1) {
|
||||||
|
p = base + (lim >> 1) * size;
|
||||||
|
cmp = (*compar)(key, p);
|
||||||
|
if (cmp == 0)
|
||||||
|
return (void *)p;
|
||||||
|
if (cmp > 0) { /* key > p: move right */
|
||||||
|
base = (const char *)p + size;
|
||||||
|
lim--;
|
||||||
|
} /* else move left */
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -6,9 +6,3 @@
|
||||||
#include "fixed.h"
|
#include "fixed.h"
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
|
|
||||||
//TODO : deprecate
|
|
||||||
//! Attention à avoir *exactement* la même taille entre ces valeurs et la carte dans map.c !
|
|
||||||
|
|
||||||
#define map_w 64
|
|
||||||
#define map_h 128
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ void add_sprite(Sprite *sprite);
|
||||||
|
|
||||||
void clear_sprites();
|
void clear_sprites();
|
||||||
|
|
||||||
|
void remove_sprite(Sprite *sprite);
|
||||||
|
|
||||||
void draw_sprites(bopti_image_t *tex_index[], RcActor *player);
|
void draw_sprites(bopti_image_t *tex_index[], RcActor *player);
|
||||||
|
|
||||||
//Returns distance (-1 if no hit), hit is set to the hit sprite
|
//Returns distance (-1 if no hit), hit is set to the hit sprite
|
||||||
|
|
|
@ -15,7 +15,6 @@ typedef struct {
|
||||||
int y0,y1;
|
int y0,y1;
|
||||||
} Rect;
|
} Rect;
|
||||||
|
|
||||||
static bool rect_rect_coll(Rect *a, Rect *b){
|
bool rect_rect_coll(Rect *a, Rect *b);
|
||||||
bool r = a->x0 >= b->x0 && a->x1 <= b->x1;
|
|
||||||
r = r && a->y0 >= b->y0;
|
int cmpfunc (const void * a, const void * b);
|
||||||
}
|
|
||||||
|
|
39
src/game.c
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "C3D/sprites.h"
|
||||||
|
#include "C3D/fixed.h"
|
||||||
|
|
||||||
|
int sreserve_c = 0;
|
||||||
|
Sprite sprite_reserve[SINDEX_S];
|
||||||
|
|
||||||
|
Rect sprite_colls[] = {
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
{.x0 = fix(.25), .y0 = fix(.25), .x1 = fix(.5), .y1 = fix(.5)}
|
||||||
|
};
|
||||||
|
|
||||||
|
Sprite *cc_mksprite(V2d pos, int type){
|
||||||
|
if(sreserve_c >= SINDEX_S)
|
||||||
|
return NULL;
|
||||||
|
Sprite *spr = &sprite_reserve[sreserve_c++];
|
||||||
|
spr->tex = type;
|
||||||
|
spr->coll = sprite_colls[type];
|
||||||
|
spr->pos = pos;
|
||||||
|
add_sprite(spr);
|
||||||
|
return spr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cc_rmsprite(int pos){
|
||||||
|
if(pos < 0 || pos >= sreserve_c)
|
||||||
|
return;
|
||||||
|
|
||||||
|
remove_sprite(&sprite_reserve[pos]);
|
||||||
|
|
||||||
|
if(pos+1 != sreserve_c){
|
||||||
|
memmove(&sprite_reserve[pos], &sprite_reserve[pos+1], sizeof(Sprite)*(sreserve_c-pos));
|
||||||
|
}
|
||||||
|
sreserve_c--;
|
||||||
|
}
|
18
src/game.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//Par Fcalva, et est sous GPLv3
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "C3D/game.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
stype_frenguy = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
RcGame _bgame;
|
||||||
|
int curr_map;
|
||||||
|
} CCGame; //CpC game Game struct
|
||||||
|
|
||||||
|
Sprite *cc_mksprite(V2d pos, int type);
|
||||||
|
|
||||||
|
void cc_rmsprite(int pos);
|
44
src/gfx.c
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//Par Fcalva et est sous GPLv3
|
||||||
|
#include <gint/display.h>
|
||||||
|
|
||||||
|
#include "C3D/fixed.h"
|
||||||
|
#include "C3D/game.h"
|
||||||
|
#include "C3D/sprites.h"
|
||||||
|
#include "C3D/moteur.h"
|
||||||
|
#include "C3D/map.h"
|
||||||
|
#include "C3D/config.h"
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
|
||||||
|
extern bopti_image_t briques0;
|
||||||
|
extern bopti_image_t buisson0;
|
||||||
|
extern bopti_image_t sprite_tst;
|
||||||
|
extern bopti_image_t sprite_tst1;
|
||||||
|
extern bopti_image_t bwain0;
|
||||||
|
extern bopti_image_t bwain1;
|
||||||
|
extern bopti_image_t meat0;
|
||||||
|
extern bopti_image_t meat1;
|
||||||
|
|
||||||
|
bopti_image_t *tex_index[TINDEX_S] = {
|
||||||
|
&briques0, //0
|
||||||
|
&buisson0, //1
|
||||||
|
&briques0, //2
|
||||||
|
&briques0, //3
|
||||||
|
&sprite_tst, //4
|
||||||
|
&bwain0, //5
|
||||||
|
&meat0 //6
|
||||||
|
};
|
||||||
|
|
||||||
|
int state = 0;
|
||||||
|
int anim_tex(GUNUSED RcGame *game){
|
||||||
|
tex_index[5] = state > 7 ? &bwain0:&bwain1;
|
||||||
|
tex_index[6] = state > 7 ? &meat0:&meat1;
|
||||||
|
tex_index[4] = state > 7 ? &sprite_tst:&sprite_tst1;
|
||||||
|
state = (state+1) % 16;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_gfx(){
|
||||||
|
add_logic_hook((RcLogicFunc*)&anim_tex);
|
||||||
|
}
|
14
src/gfx.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//Par Fcalva et est sous GPLv3
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gint/display.h>
|
||||||
|
|
||||||
|
#include "C3D/fixed.h"
|
||||||
|
#include "C3D/game.h"
|
||||||
|
#include "C3D/sprites.h"
|
||||||
|
#include "C3D/moteur.h"
|
||||||
|
#include "C3D/map.h"
|
||||||
|
#include "C3D/config.h"
|
||||||
|
|
||||||
|
void init_gfx();
|
118
src/main.c
|
@ -12,13 +12,16 @@
|
||||||
#include <libprof.h>
|
#include <libprof.h>
|
||||||
|
|
||||||
#include "C3D/fixed.h"
|
#include "C3D/fixed.h"
|
||||||
|
|
||||||
#include "C3D/game.h"
|
#include "C3D/game.h"
|
||||||
#include "C3D/sprites.h"
|
#include "C3D/sprites.h"
|
||||||
#include "C3D/moteur.h"
|
#include "C3D/moteur.h"
|
||||||
#include "C3D/map.h"
|
#include "C3D/map.h"
|
||||||
#include "C3D/config.h"
|
#include "C3D/config.h"
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
#include "map.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
//====== Copy3DEngine =====
|
//====== Copy3DEngine =====
|
||||||
// Git du moteur : https://git.planet-casio.com/Fcalva/Copy3DEngine
|
// Git du moteur : https://git.planet-casio.com/Fcalva/Copy3DEngine
|
||||||
// Git du jeu : [Rajoutez le vôtre ici]
|
// Git du jeu : [Rajoutez le vôtre ici]
|
||||||
|
@ -29,42 +32,29 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
bopti_image_t *tex_index[TINDEX_S];
|
extern bopti_image_t *tex_index[TINDEX_S];
|
||||||
|
|
||||||
extern uint8_t map_test[map_w][map_h];
|
|
||||||
|
|
||||||
//Vos images ici
|
|
||||||
|
|
||||||
extern bopti_image_t briques0;
|
|
||||||
extern bopti_image_t buisson0;
|
|
||||||
extern bopti_image_t sprite_tst;
|
|
||||||
|
|
||||||
char disp_frame_time = 0;
|
char disp_frame_time = 0;
|
||||||
char first_frame = 0;
|
char first_frame = 0;
|
||||||
int frame_time_timer = 1;
|
int frame_time_timer = 1;
|
||||||
|
|
||||||
RcMap map0 = {
|
CCGame game = {
|
||||||
.w = 128,
|
._bgame = {
|
||||||
.h = 64,
|
.player = {
|
||||||
.dat = (void*)&map_test
|
.pos = {fix(3.1), fix(3.1)},
|
||||||
};
|
.dir = {fix(0), fix(1)},
|
||||||
|
.plane = {fix(0.66), fix(0)}
|
||||||
RcGame game = {
|
},
|
||||||
.player = {
|
.flags = {0}
|
||||||
.pos = {fix(3.1), fix(3.1)},
|
}
|
||||||
.dir = {fix(0), fix(1)},
|
|
||||||
.plane = {fix(0.66), fix(0)}
|
|
||||||
},
|
|
||||||
.current_map = &map0,
|
|
||||||
.flags = {0}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int frame_time = 1;
|
int frame_time = 1;
|
||||||
|
|
||||||
void keys_get(){
|
void keys_get(RcGame *game){
|
||||||
pollevent();
|
pollevent();
|
||||||
|
|
||||||
move(&game);
|
move(game);
|
||||||
|
|
||||||
if (keydown(KEY_F1) && frame_time_timer <= 0) {
|
if (keydown(KEY_F1) && frame_time_timer <= 0) {
|
||||||
if (disp_frame_time == 0) {
|
if (disp_frame_time == 0) {
|
||||||
|
@ -77,10 +67,22 @@ void keys_get(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frame_time_timer--;
|
frame_time_timer--;
|
||||||
if (keydown(KEY_EXIT)) game.flags.exit = 1;
|
if (keydown(KEY_EXIT)) game->flags.exit = 1;
|
||||||
|
|
||||||
if(keydown(KEY_F2)){
|
if(keydown(KEY_F2)){
|
||||||
dprint(0,0,3,"%d",raycast(&game, &game.player, NULL));
|
dprint(0,0,3,"%d",raycast(game, &game->player, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(keydown(KEY_F3)){
|
||||||
|
cc_mksprite(game->player.pos, stype_frenguy);
|
||||||
|
while(keydown(KEY_F3)){
|
||||||
|
clearevents();
|
||||||
|
pollevent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(keydown(KEY_F4)){
|
||||||
|
cc_rmsprite(0);
|
||||||
|
while(keydown(KEY_F4)) { clearevents(); pollevent();}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef debug
|
#ifdef debug
|
||||||
|
@ -88,15 +90,6 @@ void keys_get(){
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_menu(){
|
|
||||||
dtext_opt(198, 100, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, NAMEOFGAME, -1);
|
|
||||||
dtext_opt(198, 120, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, "De "AUTHOR, -1);
|
|
||||||
dtext_opt(198, 150, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, "Appuyez sur une touche", -1);
|
|
||||||
|
|
||||||
dupdate();
|
|
||||||
getkey();
|
|
||||||
}
|
|
||||||
|
|
||||||
Sprite tsprite = {
|
Sprite tsprite = {
|
||||||
.pos = {200000, 300000},
|
.pos = {200000, 300000},
|
||||||
.tex = 4
|
.tex = 4
|
||||||
|
@ -104,7 +97,7 @@ Sprite tsprite = {
|
||||||
|
|
||||||
int movdir = 1;
|
int movdir = 1;
|
||||||
|
|
||||||
int test_logic(RcGame *game){
|
int test_logic(GUNUSED RcGame *game){
|
||||||
tsprite.pos.x += movdir*500;
|
tsprite.pos.x += movdir*500;
|
||||||
if(tsprite.pos.x > fix(4) || tsprite.pos.x < fix(2))
|
if(tsprite.pos.x > fix(4) || tsprite.pos.x < fix(2))
|
||||||
movdir = -movdir;
|
movdir = -movdir;
|
||||||
|
@ -112,27 +105,21 @@ int test_logic(RcGame *game){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bopti_image_t sprite_tst;
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
RcGame *rcgame = (RcGame*)&game;
|
||||||
|
|
||||||
dclear(C_WHITE);
|
dclear(C_WHITE);
|
||||||
|
|
||||||
//trucs de chargement
|
//trucs de chargement
|
||||||
|
|
||||||
load_map();
|
load_map();
|
||||||
|
|
||||||
tex_index[1] = &buisson0;
|
|
||||||
tex_index[2] = &briques0;
|
|
||||||
|
|
||||||
//Vos textures générées procéduralement (TODO)
|
|
||||||
|
|
||||||
tex_index[0] = &briques0;
|
|
||||||
tex_index[3] = &briques0;
|
|
||||||
|
|
||||||
tex_index[4] = &sprite_tst;
|
|
||||||
|
|
||||||
prof_init();
|
prof_init();
|
||||||
|
|
||||||
if(dgray(DGRAY_ON))
|
if(dgray(DGRAY_ON))
|
||||||
goto c3d_abort;
|
rcgame->flags.exit = 1;
|
||||||
dupdate();
|
dupdate();
|
||||||
|
|
||||||
dclear(0);
|
dclear(0);
|
||||||
|
@ -145,35 +132,35 @@ int main(){
|
||||||
add_sprite(&tsprite);
|
add_sprite(&tsprite);
|
||||||
|
|
||||||
add_logic_hook((RcLogicFunc*)&test_logic);
|
add_logic_hook((RcLogicFunc*)&test_logic);
|
||||||
|
|
||||||
while (!game.flags.exit) {
|
init_gfx();
|
||||||
|
|
||||||
|
init_map(&game);
|
||||||
|
|
||||||
|
while (!rcgame->flags.exit) {
|
||||||
prof_t frame = prof_make();
|
prof_t frame = prof_make();
|
||||||
prof_enter(frame);
|
prof_enter(frame);
|
||||||
|
|
||||||
dclear(C_WHITE);
|
dclear(C_WHITE);
|
||||||
|
|
||||||
if(first_frame){
|
keys_get(rcgame);
|
||||||
main_menu();
|
|
||||||
}
|
|
||||||
|
|
||||||
keys_get();
|
|
||||||
|
|
||||||
do_logic(&game, frame_time);
|
do_logic(rcgame, frame_time);
|
||||||
|
|
||||||
draw_walls(
|
draw_walls(
|
||||||
#if debug
|
#if debug
|
||||||
&timers,
|
&timers,
|
||||||
#endif
|
#endif
|
||||||
&game
|
rcgame
|
||||||
);
|
);
|
||||||
|
|
||||||
draw_sprites(tex_index, &game.player);
|
draw_sprites(tex_index, &rcgame->player);
|
||||||
|
|
||||||
if (disp_frame_time == 1) dprint( 0, 0, C_BLACK, "%d ms", frame_time/1000);
|
if (disp_frame_time == 1) dprint( 0, 0, C_BLACK, "%d ms", frame_time/1000);
|
||||||
|
|
||||||
#if debug
|
#if debug
|
||||||
dprint( 1, 27, C_BLACK, "pX %d", game.player.pos.x);
|
dprint( 1, 27, C_BLACK, "pX %d", ffloor(rcgame->player.pos.x));
|
||||||
dprint( 1, 36, C_BLACK, "pY %d", game.player.pos.y);
|
dprint( 1, 36, C_BLACK, "pY %d", ffloor(rcgame->player.pos.y));
|
||||||
dprint( 1, 9, C_BLACK, "Rct %d", prof_time(timers.raycast_time));
|
dprint( 1, 9, C_BLACK, "Rct %d", prof_time(timers.raycast_time));
|
||||||
dprint( 1, 18, C_BLACK, "Dt %d", prof_time(timers.draw_time));
|
dprint( 1, 18, C_BLACK, "Dt %d", prof_time(timers.draw_time));
|
||||||
timers.raycast_time = prof_make();
|
timers.raycast_time = prof_make();
|
||||||
|
@ -182,20 +169,15 @@ int main(){
|
||||||
|
|
||||||
dupdate();
|
dupdate();
|
||||||
prof_leave(frame);
|
prof_leave(frame);
|
||||||
frame_time = (int)prof_time(frame);
|
frame_time = prof_time(frame);
|
||||||
first_frame = 0;
|
first_frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c3d_abort:
|
|
||||||
|
|
||||||
dgray(DGRAY_OFF);
|
dgray(DGRAY_OFF);
|
||||||
|
|
||||||
prof_quit();
|
prof_quit();
|
||||||
|
|
||||||
//Libérez vos textures générées procéduralement
|
//Libérez vos textures générées procéduralement
|
||||||
|
|
||||||
//bopti_free(tex_index[0]);
|
|
||||||
//bopti_free(tex_index[3]);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
44
src/map.c
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "C3D/map.h"
|
||||||
|
#include "C3D/moteur.h"
|
||||||
|
#include "C3D/game.h"
|
||||||
|
|
||||||
|
#include "map.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
uint8_t __attribute__((section(".rodata"))) map_dat0[] = {
|
||||||
|
1,1,1,1,1,1,1,1,1,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,0,4,0,0,0,0,2,0,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,0,5,5,6,6,0,1,0,1,
|
||||||
|
1,0,0,0,0,0,0,0,0,1,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,
|
||||||
|
};
|
||||||
|
|
||||||
|
RcMap map0 = {
|
||||||
|
.w = 10,
|
||||||
|
.h = 10,
|
||||||
|
.dat = (void*)&map_dat0
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAPC 1
|
||||||
|
|
||||||
|
RcMap *maps[MAPC] = {
|
||||||
|
&map0
|
||||||
|
};
|
||||||
|
|
||||||
|
void init_map(CCGame *game){
|
||||||
|
switch_map(game, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
void switch_map(CCGame *game, int map){
|
||||||
|
game->_bgame.current_map = maps[map];
|
||||||
|
game->curr_map = map;
|
||||||
|
}
|
13
src/map.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
//Par Fcalva et est sous GPLv3
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "C3D/game.h"
|
||||||
|
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
void init_map(CCGame *game);
|
||||||
|
|
||||||
|
void switch_map(CCGame *game, int map);
|