Compare commits

...

2 commits

Author SHA1 Message Date
attilavs2
599d5295b7 Logique delta time 2024-10-09 16:43:10 +02:00
attilavs2
39a4bd035a Restructuration du projet 2024-10-09 00:18:31 +02:00
33 changed files with 146 additions and 806 deletions

View file

@ -16,10 +16,13 @@ set(NAMEOFGAME "Test3D")
set(AUTHOR "Fcalva")
set(SOURCES
#sources de votre jeu
src/main.c
src/moteur.c
src/map.c
src/sprites.c
#sources du moteur
eng/moteur.c
eng/map.c
eng/sprites.c
eng/game.c
)
set(ASSETS
@ -32,6 +35,7 @@ fxconv_declare_assets(${ASSETS} WITH_METADATA)
add_executable(Copy3DEngine ${SOURCES} ${ASSETS})
target_compile_options(Copy3DEngine PRIVATE -Wall -Wextra -Ofast)
target_include_directories(Copy3DEngine PRIVATE "include/C3D/")
target_compile_definitions(Copy3DEngine PRIVATE NAMEOFGAME="${NAMEOFGAME}" AUTHOR="${AUTHOR}")
target_link_libraries(Copy3DEngine Gint::Gint)
target_link_libraries(Copy3DEngine LibProf::LibProf)

View file

@ -1,44 +0,0 @@
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
# toolchain file and module path of the fxSDK
cmake_minimum_required(VERSION 3.15)
project(Copy3DEngine)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.9 REQUIRED)
find_package(LibProf 2.1 REQUIRED)
# le nom de votre jeu
set(NAMEOFGAME "Amogus")
# Nom de l'auteur -> votre nom/pseudo
set(AUTHOR "Fcalva")
set(SOURCES
src/main.c
src/moteur.c
src/map.c
)
set(ASSETS
assets-cg/textures/0.png
assets-cg/textures/1.png
assets-cg/textures/2.png
assets-cg/textures/3.png
assets-cg/textures/4.png
assets-cg/textures/rick.png
)
fxconv_declare_assets(${ASSETS} WITH_METADATA)
add_executable(Copy3DEngine ${SOURCES} ${ASSETS})
target_compile_options(Copy3DEngine PRIVATE -Wall -Wextra -Ofast -fira-region=all -flto -fno-math-errno -funsafe-math-optimizations -fassociative-math -freciprocal-math)
target_compile_definitions(Copy3DEngine PRIVATE NAMEOFGAME="${NAMEOFGAME}" AUTHOR="${AUTHOR}")
target_link_libraries(Copy3DEngine Gint::Gint)
target_link_libraries(Copy3DEngine LibProf::LibProf)
target_link_options(Copy3DEngine PRIVATE -Wl,--print-memory-usage,-flto)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET Copy3DEngine OUTPUT "${NAMEOFGAME}.g3a"
NAME "${NAMEOFGAME}" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

View file

@ -1,5 +0,0 @@
# Amogus
### Mogus
Sus

View file

@ -1,6 +0,0 @@
zombard1.png:
type: bopti-image
name: zombard
skybox0.png:
type: bopti-image
name: skybox_quarter

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,19 +0,0 @@
0.png:
type: bopti-image
name: frame0
1.png:
type: bopti-image
name: frame1
2.png:
type: bopti-image
name: frame2
3.png:
type: bopti-image
name: frame3
4.png:
type: bopti-image
name: frame4
rick.png:
type: bopti-image
name: rick

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -1,87 +0,0 @@
//---
// fixed: 16:16 fixed-point arithmetic
//---
//vient de https://gitea.planet-casio.com/Slyvtt/OutRun/src/branch/master/src
//
#pragma once
#include <stdint.h>
typedef int32_t fixed_t;
/* Standard arithmetic. */
static inline fixed_t fmul(fixed_t left, fixed_t right)
{
/* Generally optimized by the compiler to use dmuls.l and xtrct */
int64_t p = (int64_t)left * (int64_t)right;
return (int32_t)(p >> 16);
}
static inline fixed_t fdiv(fixed_t left, fixed_t right)
{
/* Pretty slow */
int64_t d = (int64_t)left << 16;
return d / right;
}
#define fix(x) ((int)((x) * 65536))
static inline fixed_t fixdouble(double constant)
{
return (fixed_t)(constant * 65536);
}
static inline fixed_t fixfloat(float constant)
{
return (fixed_t)(constant * 65536);
}
static inline fixed_t fdec(fixed_t f)
{
return f & 0xffff;
}
static inline int ffloor(fixed_t f)
{
return f >> 16;
}
static inline int fceil(fixed_t f)
{
return (f + 0xffff) >> 16;
}
static inline int fround(fixed_t f)
{
return (f + 0x8000) >> 16;
}
static inline float f2float(fixed_t f)
{
return (float)f / 65536;
}
static inline double f2double(fixed_t f)
{
return (double)f / 65536;
}
static inline double f2int(fixed_t f)
{
return (int)f / 65536;
}
static inline fixed_t feasein(fixed_t x)
{
return fmul(x, x);
}
static inline fixed_t fease(fixed_t x)
{
if(x <= fix(0.5)) {
return 2 * fmul(x, x);
}
else {
x = fix(1) - x;
return fix(1) - 2 * fmul(x, x);
}
}

View file

@ -1,166 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/image.h>
#include <libprof.h>
#include "fixed.h"
#include "moteur.h"
#include "map.h"
//====== Copy3DEngine =====
// Git du moteur : https://gitea.planet-casio.com/Fcalva/Copy3DEngine
// Git du jeu : [Rajoutez le vôtre ici]
//
// Page du jeu : [La vôtre ici]
//
// Voir README.md pour license précise, par Fcalva et est sous GPLv3
//
//
#ifndef FXCG50
#error Ce code est pour FXCG50/G90+E uniquement, enlevez ce message a vos riques et périls
#endif
//#define debug //pour afficher les infos de debug
image_t *tex_index[TINDEX_S];
extern char map_test[map_w][map_h];
//Vos images ici
extern image_t frame0;
extern image_t frame1;
extern image_t frame2;
extern image_t frame3;
extern image_t frame4;
extern image_t rick;
char exit_game = 0;
char disp_frame_time = 0;
char first_frame = 0;
int frame_time_timer = 1;
fixed_t posX;
fixed_t posY;
fixed_t dirX;
fixed_t dirY;
fixed_t planeX;
fixed_t planeY;
int frame_time = 1;
void keys_get(){
pollevent();
move();
if (keydown(KEY_F1) && frame_time_timer <= 0) {
if (disp_frame_time == 0) {
disp_frame_time = 1;
frame_time_timer = 10;
}
else {
disp_frame_time = 0;
frame_time_timer = 10;
}
}
frame_time_timer--;
if (keydown(KEY_EXIT)) exit_game = 1;
#ifdef debug
if (keydown(KEY_TAN)) end_screen();
#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();
}
int main(){
dclear(C_WHITE);
//trucs de chargement
load_map();
image_t *frame_buffer = image_create_vram();
extern image_t *tex_index[TINDEX_S];
tex_index[1] = &frame0;
tex_index[2] = &rick;
//Vos textures générées procéduralement
tex_index[0] = image_alloc(64, 64, IMAGE_RGB565);
tex_index[3] = image_alloc(64, 64, IMAGE_RGB565);
image_fill(tex_index[0], 0x4228);
image_fill(tex_index[3], 0x9dbd);
prof_init();
int anim_timer = 0;
while (!exit_game) {
prof_t frame = prof_make();
prof_enter(frame);
drect(0, 0, 395, 112, 0x9dbd);
drect(0,112, 395, 243, 0x4228);
switch((anim_timer/62)%5){
case 0: tex_index[1] = &frame0; break;
case 1: tex_index[1] = &frame1; break;
case 2: tex_index[1] = &frame2; break;
case 3: tex_index[1] = &frame3; break;
case 4: tex_index[1] = &frame4; break;
}
draw_walls(frame_buffer);
if(first_frame == 1){
main_menu();
}
keys_get();
if (disp_frame_time == 1) dprint( 1, 10, C_BLACK, "Frame time : %d ms", frame_time);
#ifdef debug
dprint( 1, 20, C_BLACK, "planeX : %d", planeX);
dprint( 1, 30, C_BLACK, "planeY : %d", planeY);
dprint( 1, 40, C_BLACK, "dirX : %d", dirX);
dprint( 1, 50, C_BLACK, "dirY : %d", dirY);
dprint( 1, 60, C_BLACK, "posX : %d", posX);
dprint( 1, 70, C_BLACK, "posY : %d", posY);
#endif
dupdate();
prof_leave(frame);
frame_time = (int)prof_time(frame)/1000;
first_frame = 0;
anim_timer += frame_time;
}
prof_quit();
//Libérez vos textures générées procéduralement
image_free(tex_index[0]);
image_free(tex_index[3]);
return 1;
}

View file

@ -1,71 +0,0 @@
// Voir README.md pour license précise, par Fcalva 1011-1011 et est sous GPLv1
#include "map.h"
#include "moteur.h"
char 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,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,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,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{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,1,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0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,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}
};

View file

@ -1,12 +0,0 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
#include "fixed.h"
#ifndef map_test_M
#define map_test_M
//! Attention à avoir *exactement* la même taille entre ces valeurs et la carte dans map.c !
#define map_w 64
#define map_h 128
#endif /* map_test.h */

View file

@ -1,325 +0,0 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <gint/display.h>
#include <gint/keyboard.h>
#include <libprof.h>
#include "fixed.h"
#include "moteur.h"
#include "map.h"
// moteur.c :
// ici se trouvent tout ce qui concerne les graphismes, mouvement et collisions
//
//
void move() {
extern int frame_time;
fixed_t moveSpeed = fmul(fix(frame_time), 0x148); //frame_time * fix(carrés/seconde/1000) là carrés/seconde = 5
fixed_t rotSpeed = fmul(fix(frame_time), 0x83); //frame_time * fix(radians/seconde/1000) là radians/seconde = 2
fixed_t c_rotSpeed = fix(cos(f2float(rotSpeed)));
fixed_t s_rotSpeed = fix(sin(f2float(rotSpeed)));
extern char map_test[map_w][map_h];
extern fixed_t planeX;
extern fixed_t planeY;
extern fixed_t dirX;
extern fixed_t dirY;
extern fixed_t posX;
extern fixed_t posY;
fixed_t oldDirX;
fixed_t oldPlaneX;
int xtemp1;
int ytemp1;
int xtemp2;
int ytemp2;
if (keydown(KEY_UP)) {
xtemp1 = f2int(posX + fmul(dirX, moveSpeed));
ytemp1 = f2int(posY);
xtemp2 = f2int(posX);
ytemp2 = f2int(posY + fmul(dirY, moveSpeed));
if(map_test[xtemp1][ytemp1] == 0) posX += fmul(dirX, moveSpeed);
if(map_test[xtemp2][ytemp2] == 0) posY += fmul(dirY, moveSpeed);
}
//move backwards if no wall behind you
if (keydown(KEY_DOWN)) {
xtemp1 = f2int(posX - fmul(dirX, moveSpeed));
ytemp1 = f2int(posY);
xtemp2 = f2int(posX);
ytemp2 = f2int(posY - fmul(dirY, moveSpeed));
if(map_test[xtemp1][ytemp1] == 0) posX -= fmul(dirX, moveSpeed);
if(map_test[xtemp2][ytemp2] == 0) posY -= fmul(dirY, moveSpeed);
}
//rotate to the rightdouble sin_rotspeed;
if (keydown(KEY_RIGHT)) {
//both camera direction and camera plane must be rotated
oldDirX = dirX;
dirX = (fmul(dirX, c_rotSpeed)+1) - (fmul(dirY, -s_rotSpeed)+1);
dirY = (fmul(oldDirX, -s_rotSpeed)+1) + (fmul(dirY, c_rotSpeed)+1);
oldPlaneX = planeX;
planeX = (fmul(planeX, c_rotSpeed)+1) - (fmul(planeY, -s_rotSpeed)+1);
planeY = (fmul(oldPlaneX, -s_rotSpeed)+1) + (fmul(planeY, c_rotSpeed)+1);
}
//rotate to the left
if (keydown(KEY_LEFT)) {
//both camera direction and camera plane must be rotated
oldDirX = dirX;
dirX = (fmul(dirX, c_rotSpeed)-1) - (fmul(dirY, s_rotSpeed)-1);
dirY = (fmul(oldDirX, s_rotSpeed)+1) + (fmul(dirY, c_rotSpeed)+1);
oldPlaneX = planeX;
planeX = (fmul(planeX, c_rotSpeed)-1) - (fmul(planeY, s_rotSpeed) - 1);
planeY = (fmul(oldPlaneX, s_rotSpeed)+1) + (fmul(planeY, c_rotSpeed) + 1);
}
if (dirX > 0xFFFF) dirX = 0xFFFF;
if (dirY > 0xFFFF) dirY = 0xFFFF;
if (dirX < -0xFFFF) dirX = -0xFFFF;
if (dirY < -0xFFFF) dirY = -0xFFFF;
}
void spawn_gen(){
extern fixed_t posX;
extern fixed_t posY;
extern fixed_t dirX;
extern fixed_t dirY;
extern fixed_t planeX;
extern fixed_t planeY;
extern char map_test[map_w][map_h];
int seed, seed_x, seed_y;
int SeedSeed;
time_t timeN;
time(&timeN);
SeedSeed = timeN;
srand(SeedSeed);
while(1){
seed = rand() * 0.5 + rand() * 0.5;
seed_x = seed & 0b1111111;
seed_y = (seed >> 8) & 0b111111;
if (seed_x < map_w && seed_y < map_h && (seed_x < 111 && seed_y > 15)){
if(map_test[seed_x][seed_y] == 0){
break;
}
}
}
fixed_t start_dirX, start_dirY;
int dirSeed = (seed >> 9) & 0b11 ;
switch(dirSeed){
case 0: {
start_dirX = 0x0;
start_dirY = 0xFFFF;
planeX = fix(0.66);
planeY = 0;
break;
}
case 1: {
start_dirX = 0xFFFF;
start_dirY = 0x0;
planeX = 0;
planeY = fix(-0.66);
break;
}
case 2: {
start_dirX = -0xFFFF;
start_dirY = 0x0;
planeX = 0;
planeY = fix(0.66);
break;
}
case 3: {
start_dirX = 0x0;
start_dirY = -0xFFFF;
planeX = fix(-0.66);
planeY = 0;
break;
}
default : {
start_dirX = 0xFFFF;
start_dirY = 0x0;
planeX = 0;
planeY = fix(-0.66);
break;
}
}
posX = fix(seed_x) + 0x7FFF;
posY = fix(seed_y) + 0x7FFF; //x and y start position
dirX = start_dirX;
dirY = start_dirY; //initial direction vector
}
void load_map(){
spawn_gen();
}
void draw_walls(image_t *frame_buffer){
extern fixed_t posX;
extern fixed_t posY;
extern fixed_t dirX;
extern fixed_t dirY;
extern fixed_t planeX;
extern fixed_t planeY;
extern image_t *tex_index[TINDEX_S];
extern char map_test[map_w][map_h];
fixed_t cameraX;
fixed_t rayDirX;
fixed_t rayDirY;
fixed_t sideDistX;//length of ray from current position to next x or y-side
fixed_t sideDistY;
fixed_t deltaDistX;
fixed_t deltaDistY;
fixed_t perpWallDist;
fixed_t texSize;
int x;
int mapX;
int mapY;
int stepX; //what direction to step in x or y-direction (either +1 or -1)
int stepY;
int side; //was a NS or a EW wall hit?
int lineHeight;
int texX;
int texSample;
int texSampleY;
int v_offset = 0; //(int)(sin(f2int(posX + posY)) * 5); //a raffiner un peu
fixed_t h_offset = 0; //fix(sin(f2int(posX - posY)) * 0.01);
struct image_linear_map temp;
for(x = 0; x < viewport_w; x++) {
//calculate ray position and direction
cameraX = fdiv(fix(x*2), fix(viewport_w)) - 0xFFFF + h_offset; //x-coordinate in camera space
rayDirX = dirX + fmul(planeX, cameraX);
rayDirY = dirY + fmul(planeY, cameraX);
//which box of the map we're in
mapX = f2int(posX);
mapY = f2int(posY);
// length of ray from one x or y-side to next x or y-side
// these are derived as:
// deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX))
// deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY))
// which can be simplified to abs(|rayDir| / rayDirX) and abs(|rayDir| / rayDirY)
// where |rayDir| is the length of the vector (rayDirX, rayDirY). Its length,
// unlike (dirX, dirY) is not 1, however this does not matter, only the
// ratio between deltaDistX and deltaDistY matters, due to the way the DDA
// stepping further below works. So the values can be computed as below.
// Division through zero is prevented, even though technically that's not
// needed in C++ with IEEE 754 floating point values.
// Fcalva : removed the 0 div prevention
deltaDistX = abs(fdiv(0xFFFF, rayDirX));
deltaDistY = abs(fdiv(0xFFFF, rayDirY));
//calculate step and initial sideDist
if (rayDirX < 0) {
stepX = -1;
sideDistX = fmul(posX - fix(mapX), deltaDistX);
}
else {
stepX = 1;
sideDistX = fmul( fix(mapX + 1) - posX, deltaDistX);
}
if (rayDirY == 0) {
stepY = 0;
sideDistY = 0;
}
else if (rayDirY < 0) {
stepY = -1;
sideDistY = fmul(posY - fix(mapY), deltaDistY);
}
else {
stepY = 1;
sideDistY = fmul( fix(mapY + 1) - posY, deltaDistY);
}
//perform DDA
while(true) {
//Check if the ray is out of range/bounds
if (sideDistX >= max_dist || sideDistY >= max_dist || mapX < 0 || mapY < 0 || mapX >= map_w || mapY >= map_h) {
break;
}
//Otherwise check if ray has hit a wall
else if (map_test[mapX][mapY] > 0) {
break;
}
//jump to next map square, either in x-direction, or in y-direction
if (sideDistX < sideDistY) {
sideDistX += deltaDistX;
mapX += stepX;
side = 0;
}
else {
sideDistY += deltaDistY;
mapY += stepY;
side = 1;
}
}
//Calculate distance projected on camera direction. This is the shortest distance from the point where the wall is
//hit to the camera plane. Euclidean to center camera point would give fisheye effect!
//This can be computed as (mapX - posX + (1 - stepX) / 2) / rayDirX for side == 0, or same formula with Y
//for size == 1, but can be simplified to the code below thanks to how sideDist and deltaDist are computed:
//because they were left scaled to |rayDir|. sideDist is the entire length of the ray above after the multiple
//steps, but we subtract deltaDist once because one step more into the wall was taken above.
if (side == 0) perpWallDist = (sideDistX - deltaDistX);
else perpWallDist = (sideDistY - deltaDistY);
//texturing calculations
//int texNum = test_map[mapX][mapY] - 1; //a voir plus tard
//calculate value of wallX
fixed_t wallX; //where exactly the wall was hit
if (side == 0) wallX = posY + fmul(perpWallDist, rayDirY);
else wallX = posX + fmul(perpWallDist, rayDirX);
wallX -= fix(floor(f2int(wallX)));
//x coordinate on the texture
texX = fmul(wallX, 64);
texX = texX % 64;
if(side == 0 && rayDirX > 0) texX = 64 - texX - 1;
if(side == 1 && rayDirY < 0) texX = 64 - texX - 1;
lineHeight = f2int(fdiv(fix(viewport_h), perpWallDist)); //Taille en px de la ligne
if (lineHeight < 1) lineHeight = 1;
//if (lineHeight > viewport_h) lineHeight = viewport_h - 1;
fixed_t texSize = fix(lineHeight) / 64; //taille proportionelle de la ligne a la tex
if (texSize < 0x400) texSize = 0x400; //0x400 = 1/64 * 2^16
if (texSize > 0x3D000) { //0x3D000 = 3.8125 * 2^16, 3.8125 = viewport_h/64
texSample = fceil(fdiv(fix(viewport_h), texSize));
texSampleY = 32 - (int)texSample * 0.5;
}
else {
texSample = 64;
texSampleY = 0;
}
image_t texStripe;
texStripe = *image_sub(tex_index[map_test[mapX][mapY]], texX, texSampleY, 1, texSample);
image_scale(&texStripe, 0xFFFF, texSize, &temp);
image_linear(&texStripe, image_at(frame_buffer, x, (int)(viewport_h * 0.5 - lineHeight * 0.5) + v_offset), &temp);
}
}

View file

@ -1,22 +0,0 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
#ifndef moteur_h
#define moteur_h
#include <gint/image.h>
//param. graphiques
#define screen_w 396
#define screen_h 224
#define viewport_w 396
#define viewport_h 224
#define max_dist 0x1FFFFF //en tuiles << 16, actuellement 32
#define TINDEX_S 256
void load_map();
void end_screen();
void draw_walls(image_t *frame_buffer);
void move();
#endif /* moteur */

48
eng/game.c Normal file
View file

@ -0,0 +1,48 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <gint/display.h>
#include <gint/keyboard.h>
#include "fixed.h"
#include "map.h"
#include "game.h"
#include "utils.h"
#include "moteur.h"
#include "sprites.h"
int lhook_c = 0;
RcLogicFunc *logic_hooks[HINDEX_S];
int add_logic_hook(RcLogicFunc *func){
if(lhook_c >= HINDEX_S)
return 1;
logic_hooks[lhook_c++] = func;
return 0;
}
//TODO
int remove_logic_hook(RcLogicFunc *func){
}
void clear_logic_hooks(){
lhook_c = 0;
}
//Time per tick, in µs
#define LOGIC_TIME (int)((1.0/TPS) * 1000000)
void do_logic(RcGame *game, int delta){
game->logic_time += delta;
for(; game->logic_time > LOGIC_TIME; game->logic_time -= LOGIC_TIME){
for(int i = 0; i < lhook_c; i++){
//TODO : Be less dramatic
if(logic_hooks[i](game)){
game->flags.exit = 1;
return;
}
}
}
}

View file

@ -99,9 +99,6 @@ void load_map(){
}
#if asm_opti
#else
#endif
//Fonction fournie par le grand Lephé :D
inline int __attribute__((always_inline))
get_pixel(bopti_image_t const *img, int u, int v)
@ -234,14 +231,12 @@ void draw_walls(
fixed_t deltaDistX;
fixed_t deltaDistY;
fixed_t perpWallDist;
fixed_t texSize;
int x;
int i;
int mapX;
int mapY;
int stepX; //what direction to step in x or y-direction (either +1 or -1)
int stepY;
int side; //was a NS or a EW wall hit?
int side = 0; //was a NS or a EW wall hit?
int lineHeight;
int texX;
int texSample;
@ -249,7 +244,7 @@ void draw_walls(
dgray_getvram(&light,&dark);
int v_offset = 0;
//int v_offset = 0;
fixed_t h_offset = 0;
//struct image_linear_map temp;

View file

@ -1,6 +1,10 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#pragma once
//param. graphiques
//===== Paramètres graphiques =====
#define screen_w 128
#define screen_h 64
#define viewport_w 128
@ -11,10 +15,19 @@
#define TSIZE 32
//===== Paramètres de jeu =====
//Ticks par seconde
#define TPS 30
//Tex index
#define TINDEX_S 16
//Sprite index
#define SINDEX_S 64
//Game logic hooks
#define HINDEX_S 16
//===== Paramètres de debug =====
#define debug 1 //pour afficher les infos de debug

48
include/C3D/game.h Normal file
View file

@ -0,0 +1,48 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#ifndef game__h
#define game__h
#include "utils.h"
#include "map.h"
typedef struct {
V2d pos;
V2d dir;
V2d plane;
} RcActor;
typedef struct {
uint8_t exit;
} RcFlags;
typedef struct {
RcActor player;
int logic_time;
uint8_t *current_map;
RcFlags flags;
} RcGame;
typedef int (RcLogicFunc)(RcGame *);
//Returns non-zero on failure (likely max hook count was reached)
int add_logic_hook(RcLogicFunc *func);
//Retruns non-zero on failure
int remove_logic_hook(RcLogicFunc *func);
void clear_logic_hooks();
void do_logic(RcGame *game, int delta);
#endif

View file

@ -1,4 +1,5 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#include "fixed.h"
#ifndef map__h

View file

@ -1,4 +1,5 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#ifndef moteur_h
#define moteur_h

View file

@ -1,4 +1,5 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#ifndef sprites__h
#define sprites__h

View file

@ -1,4 +1,5 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#ifndef utils__h
#define utils__h

View file

@ -1,25 +0,0 @@
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
#ifndef game__h
#define game__h
#include "utils.h"
#include "map.h"
typedef struct {
V2d pos;
V2d dir;
V2d plane;
} RcActor;
typedef struct {
RcActor player;
uint8_t *current_map;
} RcGame;
#endif

View file

@ -13,9 +13,7 @@
#include "fixed.h"
//#include "utils.h"
#include "game.h"
#include "gint/display-fx.h"
#include "moteur.h"
#include "map.h"
#include "config.h"
@ -41,7 +39,6 @@ extern bopti_image_t briques0;
extern bopti_image_t buisson0;
extern bopti_image_t sprite_tst;
char exit_game = 0;
char disp_frame_time = 0;
char first_frame = 0;
int frame_time_timer = 1;
@ -52,7 +49,8 @@ RcGame game = {
.dir = {fix(0), fix(1)},
.plane = {fix(0.66), fix(0)}
},
.current_map = (void*)&map_test
.current_map = (void*)&map_test,
.flags = {0}
};
int frame_time = 1;
@ -73,7 +71,7 @@ void keys_get(){
}
}
frame_time_timer--;
if (keydown(KEY_EXIT)) exit_game = 1;
if (keydown(KEY_EXIT)) game.flags.exit = 1;
#ifdef debug
//if (keydown(KEY_TAN)) end_screen();
@ -89,6 +87,21 @@ void main_menu(){
getkey();
}
Sprite tsprite = {
.pos = {200000, 300000},
.tex = 4
};
int movdir = 1;
int test_logic(RcGame *game){
tsprite.pos.x += movdir*500;
if(tsprite.pos.x > fix(4) || tsprite.pos.x < fix(2))
movdir = -movdir;
return 0;
}
int main(){
dclear(C_WHITE);
@ -113,22 +126,17 @@ int main(){
dupdate();
dclear(0);
dprint(0,0,3,"%d",image_layer_count(sprite_tst.profile));
dupdate();getkey();
#if debug
EngineTimers timers;
//gdb_start_on_exception();
#endif
Sprite tsprite = {
.pos = {200000, 300000},
.tex = 4
};
add_sprite(&tsprite);
while (!exit_game) {
add_logic_hook((RcLogicFunc*)&test_logic);
while (!game.flags.exit) {
prof_t frame = prof_make();
prof_enter(frame);
@ -140,6 +148,8 @@ int main(){
keys_get();
do_logic(&game, frame_time*1000);
draw_walls(
#if debug
&timers,