mirror of
https://git.planet-casio.com/Fcalva/Copy3DEngine.git
synced 2024-12-28 04:23:44 +01:00
Branche omega
This commit is contained in:
parent
751e2e9a70
commit
ed2afa0864
14 changed files with 16533 additions and 166 deletions
38
Makefile
Normal file
38
Makefile
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
CC=sh-elf-gcc
|
||||||
|
CFLAGS= -I/home/fr/.local/include -ffreestanding -flto -nostdlib -Og -Wall -Wextra -Xlinker
|
||||||
|
NAME=
|
||||||
|
FILENAME="omega"
|
||||||
|
OBJCOPY = sh-elf-objcopy
|
||||||
|
SRC_DIR=src
|
||||||
|
CONV_DIR=oconv
|
||||||
|
BUILD_DIR=build
|
||||||
|
|
||||||
|
|
||||||
|
SRC := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/*.s)
|
||||||
|
SRC += $(wildcard $(SRC_DIR)/*/*.c $(SRC_DIR)/*/*.s)
|
||||||
|
|
||||||
|
all: mkdir convert compile clean
|
||||||
|
no_clean : mkdir convert compile
|
||||||
|
mkdir:
|
||||||
|
mkdir -p build
|
||||||
|
|
||||||
|
convert:
|
||||||
|
#cd oconv && python3 convert.py ../assets-cg/
|
||||||
|
#cd ..
|
||||||
|
|
||||||
|
compile: $(FILENAME).g3a
|
||||||
|
|
||||||
|
$(FILENAME).g3a : $(BUILD_DIR)/$(FILENAME).bin
|
||||||
|
mkg3a -n "basic:$(NAME)" -i uns:assets-cg/uns-icon.bmp -i sel:assets-cg/sel-icon.bmp $(BUILD_DIR)/$(FILENAME).bin $(FILENAME).g3a
|
||||||
|
|
||||||
|
$(BUILD_DIR)/$(FILENAME).bin : $(BUILD_DIR)/$(FILENAME).elf
|
||||||
|
$(OBJCOPY) -O binary $(BUILD_DIR)/$(FILENAME).elf $(BUILD_DIR)/$(FILENAME).bin
|
||||||
|
$(BUILD_DIR)/$(FILENAME).elf: $(SRC)
|
||||||
|
sh-elf-gcc $(CFLAGS) -T linker.ld -o $(BUILD_DIR)/$(FILENAME).elf $(SRC) /home/fr/.local/lib/omega.a /home/fr/.local/share/giteapc/Lephenixnoir/OpenLibm/libopenlibm.a $(wildcard $(CONV_DIR)/*.S) -lgcc -lm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
#rm -rf build
|
||||||
|
#rm -f oconv/*.S
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: all clean
|
BIN
assets-cg/font.png
Normal file
BIN
assets-cg/font.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
1
assets-cg/oconv.txt
Normal file
1
assets-cg/oconv.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
font.png : image, font
|
BIN
assets-cg/sel-icon.bmp
Normal file
BIN
assets-cg/sel-icon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
assets-cg/uns-icon.bmp
Normal file
BIN
assets-cg/uns-icon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
build/omega.bin
Executable file
BIN
build/omega.bin
Executable file
Binary file not shown.
BIN
build/omega.elf
Executable file
BIN
build/omega.elf
Executable file
Binary file not shown.
73
linker.ld
Normal file
73
linker.ld
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
ENTRY(_start)
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
|
||||||
|
rom (rx): o = 0x00300000, l = 2M
|
||||||
|
/*First 0x1400 bytes are reserved for VBR (starting at 0x08100000)*/
|
||||||
|
ram (rw): o = 0x08101400, l = 491k
|
||||||
|
|
||||||
|
}
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
|
||||||
|
_srom = SIZEOF(.pretext) + SIZEOF(.text) + SIZEOF(.rodata);
|
||||||
|
|
||||||
|
.pretext : {
|
||||||
|
*(.text.entry)
|
||||||
|
} > rom
|
||||||
|
.text : {
|
||||||
|
_exch_start = . ;
|
||||||
|
*(.omega.exch)
|
||||||
|
_exch_size = ABSOLUTE (. - _exch_start);
|
||||||
|
|
||||||
|
_inth_start = . ;
|
||||||
|
*(.omega.inth)
|
||||||
|
_inth_size = ABSOLUTE (. - _inth_start);
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_tlbh_start = . ;
|
||||||
|
*(.omega.tlbh)
|
||||||
|
_tlbh_size = ABSOLUTE (. - _tlbh_start);
|
||||||
|
|
||||||
|
*(.text .text.*)
|
||||||
|
|
||||||
|
} > rom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.rodata : {
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
} > rom
|
||||||
|
|
||||||
|
|
||||||
|
. = ORIGIN(ram);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_rdata = .;
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.omega.vram)
|
||||||
|
_ldata = LOADADDR(.data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} > ram AT > rom
|
||||||
|
_sdata = SIZEOF(.data);
|
||||||
|
|
||||||
|
.bss (NOLOAD) : {
|
||||||
|
_rbss = . ;
|
||||||
|
|
||||||
|
*(.bss .bss.* COMMON)
|
||||||
|
|
||||||
|
} > ram :NONE
|
||||||
|
_sbss = SIZEOF(.bss);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* not important : comments */
|
||||||
|
/DISCARD/ : {
|
||||||
|
*(.comment)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
72
oconv/convert.py
Normal file
72
oconv/convert.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
def rgb_to_rgb565(rgb_tuple):
|
||||||
|
r = rgb_tuple[0]
|
||||||
|
g = rgb_tuple[1]
|
||||||
|
b = rgb_tuple[2]
|
||||||
|
return (int(r/255*31)<<11)|(int(g/255*63)<<5) | int(b/255*31)
|
||||||
|
|
||||||
|
class image:
|
||||||
|
def __init__(self, path):
|
||||||
|
self.image = Image.open(path)
|
||||||
|
def getImage(self):
|
||||||
|
return self.image
|
||||||
|
def setImage(self,path):
|
||||||
|
self.image = Image.open(path)
|
||||||
|
def getpixels(self):
|
||||||
|
width, height = self.image.size
|
||||||
|
pixels = []
|
||||||
|
for y in range(height):
|
||||||
|
for x in range(width):
|
||||||
|
pixel = self.image.getpixel((x, y))
|
||||||
|
pixels.append(rgb_to_rgb565(pixel))
|
||||||
|
return pixels
|
||||||
|
|
||||||
|
class converter:
|
||||||
|
def __init__(self, file):
|
||||||
|
self.file = file
|
||||||
|
def getFile(self):
|
||||||
|
return self.file
|
||||||
|
def setFile(self, file):
|
||||||
|
self.file = file
|
||||||
|
|
||||||
|
def write_word(self, data):
|
||||||
|
asm = ""
|
||||||
|
asm += ".word " + hex(data)
|
||||||
|
return asm
|
||||||
|
|
||||||
|
def convert_image(self, symbol, section=".rodata"):
|
||||||
|
img = image(self.file)
|
||||||
|
asmc = f".section {section} \n"
|
||||||
|
asmc += f".global _{symbol}\n"
|
||||||
|
asmc += f"_{symbol}:\n"
|
||||||
|
width,height = img.getImage().size
|
||||||
|
asmc += self.write_word(height) + "\n"
|
||||||
|
asmc += self.write_word(width) + "\n"
|
||||||
|
pixels = img.getpixels()
|
||||||
|
for i in pixels:
|
||||||
|
asmc += self.write_word(i) + "\n"
|
||||||
|
f = open(symbol + ".S", "wb")
|
||||||
|
f.write(asmc.encode('utf-8'))
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
dir = sys.argv[1]
|
||||||
|
ls = os.listdir(dir)
|
||||||
|
if not "oconv.txt" in ls:
|
||||||
|
print(" OConv ----- oconv.txt cannot be found")
|
||||||
|
exit()
|
||||||
|
print("\n")
|
||||||
|
conf = open(f"{dir}oconv.txt", 'r').read().replace(" ","")
|
||||||
|
files = conf.split("\n")
|
||||||
|
for file in files:
|
||||||
|
filename, metadatas = file.split(":")
|
||||||
|
type, name = metadatas.split(",")
|
||||||
|
print(f" OConv ----- Converting {filename}")
|
||||||
|
conv = converter(dir+filename)
|
||||||
|
if(type == "image"):
|
||||||
|
conv.convert_image(name)
|
||||||
|
print("\n")
|
8197
oconv/font.S
Normal file
8197
oconv/font.S
Normal file
File diff suppressed because it is too large
Load diff
307
src/main.c
307
src/main.c
|
@ -1,149 +1,158 @@
|
||||||
#include <stdlib.h>
|
#include <omega/display.h>
|
||||||
#include <math.h>
|
#include <omega/keyboard.h>
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <stdlib.h>
|
||||||
#include <gint/keyboard.h>
|
#include <math.h>
|
||||||
#include <gint/image.h>
|
|
||||||
#include <libprof.h>
|
//#include <gint/display.h>
|
||||||
|
//#include <gint/keyboard.h>
|
||||||
#include "fixed.h"
|
//#include <gint/image.h>
|
||||||
|
//#include <libprof.h>
|
||||||
#include "moteur.h"
|
|
||||||
#include "map.h"
|
#include "fixed.h"
|
||||||
|
|
||||||
//====== Copy3DEngine =====
|
//#include "keycodes.h"
|
||||||
// Git du moteur : https://gitea.planet-casio.com/Fcalva/Copy3DEngine
|
|
||||||
// Git du jeu : [Rajoutez le vôtre ici]
|
#include "moteur.h"
|
||||||
//
|
#include "map.h"
|
||||||
// Page du jeu : [La vôtre ici]
|
|
||||||
//
|
//====== Copy3DEngine =====
|
||||||
// Voir README.md pour license précise, par Fcalva et est sous GPLv3
|
// 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]
|
||||||
#ifndef FXCG50
|
//
|
||||||
#error Ce code est pour FXCG50/G90+E uniquement, enlevez ce message a vos riques et périls
|
// Voir README.md pour license précise, par Fcalva et est sous GPLv3
|
||||||
#endif
|
//
|
||||||
|
//
|
||||||
//#define debug //pour afficher les infos de debug
|
|
||||||
|
/*#ifndef FXCG50
|
||||||
image_t *tex_index[TINDEX_S];
|
#error Ce code est pour FXCG50/G90+E uniquement, enlevez ce message a vos riques et périls
|
||||||
|
#endif*/
|
||||||
extern char map_test[map_w][map_h];
|
|
||||||
|
//#define debug //pour afficher les infos de debug
|
||||||
//Vos images ici
|
|
||||||
|
//image_t *tex_index[TINDEX_S];
|
||||||
extern image_t briques0;
|
|
||||||
extern image_t buisson0;
|
extern char map_test[map_w][map_h];
|
||||||
|
|
||||||
char exit_game = 0;
|
//Vos images ici
|
||||||
char disp_frame_time = 0;
|
|
||||||
char first_frame = 0;
|
//extern image_t briques0;
|
||||||
int frame_time_timer = 1;
|
//extern image_t buisson0;
|
||||||
|
|
||||||
fixed_t posX;
|
char exit_game = 0;
|
||||||
fixed_t posY;
|
char disp_frame_time = 0;
|
||||||
fixed_t dirX;
|
char first_frame = 0;
|
||||||
fixed_t dirY;
|
int frame_time_timer = 1;
|
||||||
fixed_t planeX;
|
|
||||||
fixed_t planeY;
|
fixed_t posX;
|
||||||
|
fixed_t posY;
|
||||||
int frame_time = 1;
|
fixed_t dirX;
|
||||||
|
fixed_t dirY;
|
||||||
void keys_get(){
|
fixed_t planeX;
|
||||||
pollevent();
|
fixed_t planeY;
|
||||||
|
|
||||||
move();
|
int frame_time = 1;
|
||||||
|
|
||||||
if (keydown(KEY_F1) && frame_time_timer <= 0) {
|
void keys_get(){
|
||||||
if (disp_frame_time == 0) {
|
//pollevent();
|
||||||
disp_frame_time = 1;
|
|
||||||
frame_time_timer = 10;
|
move();
|
||||||
}
|
|
||||||
else {
|
if (keydown(KEY_F1) && frame_time_timer <= 0) {
|
||||||
disp_frame_time = 0;
|
if (disp_frame_time == 0) {
|
||||||
frame_time_timer = 10;
|
disp_frame_time = 1;
|
||||||
}
|
frame_time_timer = 10;
|
||||||
}
|
}
|
||||||
frame_time_timer--;
|
else {
|
||||||
if (keydown(KEY_EXIT)) exit_game = 1;
|
disp_frame_time = 0;
|
||||||
|
frame_time_timer = 10;
|
||||||
#ifdef debug
|
}
|
||||||
if (keydown(KEY_TAN)) end_screen();
|
}
|
||||||
#endif
|
frame_time_timer--;
|
||||||
}
|
if (keydown(KEY_EXIT)) exit_game = 1;
|
||||||
|
|
||||||
void main_menu(){
|
#ifdef debug
|
||||||
//dtext_opt(198, 100, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, NAMEOFGAME, -1);
|
if (keydown(KEY_TAN)) end_screen();
|
||||||
//dtext_opt(198, 120, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, "De " AUTHOR, -1);
|
#endif
|
||||||
dtext_opt(198, 150, 0xde85, C_NONE, DTEXT_CENTER, DTEXT_TOP, "Appuyez sur une touche", -1);
|
}
|
||||||
|
|
||||||
dupdate();
|
void main_menu(){
|
||||||
getkey();
|
//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);
|
||||||
int main(){
|
|
||||||
dclear(C_WHITE);
|
//dupdate();
|
||||||
|
//getkey();
|
||||||
//trucs de chargement
|
}
|
||||||
|
|
||||||
load_map();
|
int main(){
|
||||||
|
|
||||||
image_t *frame_buffer = image_create_vram();
|
keyboard_setup();
|
||||||
|
|
||||||
extern image_t *tex_index[TINDEX_S];
|
//dclear(C_WHITE);
|
||||||
|
|
||||||
tex_index[1] = &buisson0;
|
//trucs de chargement
|
||||||
tex_index[2] = &briques0;
|
|
||||||
|
//load_map();
|
||||||
//Vos textures générées procéduralement
|
|
||||||
|
//image_t *frame_buffer = image_create_vram();
|
||||||
tex_index[0] = image_alloc(64, 64, IMAGE_RGB565);
|
|
||||||
tex_index[3] = image_alloc(64, 64, IMAGE_RGB565);
|
//extern image_t *tex_index[TINDEX_S];
|
||||||
|
|
||||||
image_fill(tex_index[0], 0x4228);
|
//tex_index[1] = &buisson0;
|
||||||
image_fill(tex_index[3], 0x9dbd);
|
//tex_index[2] = &briques0;
|
||||||
|
|
||||||
prof_init();
|
//Vos textures générées procéduralement
|
||||||
|
|
||||||
while (!exit_game) {
|
//tex_index[0] = image_alloc(64, 64, IMAGE_RGB565);
|
||||||
prof_t frame = prof_make();
|
//tex_index[3] = image_alloc(64, 64, IMAGE_RGB565);
|
||||||
prof_enter(frame);
|
|
||||||
|
//image_fill(tex_index[0], 0x4228);
|
||||||
drect(0, 0, 395, 112, 0x9dbd);
|
//image_fill(tex_index[3], 0x9dbd);
|
||||||
drect(0,112, 395, 243, 0xc4c9);
|
|
||||||
|
//prof_init();
|
||||||
draw_walls(frame_buffer);
|
|
||||||
|
while (!exit_game) {
|
||||||
if(first_frame == 1){
|
//prof_t frame = prof_make();
|
||||||
main_menu();
|
//prof_enter(frame);
|
||||||
}
|
|
||||||
|
drect(0, 0, 395, 112, 0x9dbd);
|
||||||
keys_get();
|
drect(0,112, 395, 243, 0xc4c9);
|
||||||
|
|
||||||
if (disp_frame_time == 1) dprint( 1, 10, C_BLACK, "Frame time : %d ms", frame_time);
|
draw_walls(/*frame_buffer*/);
|
||||||
|
|
||||||
#ifdef debug
|
if(first_frame == 1){
|
||||||
dprint( 1, 20, C_BLACK, "planeX : %d", planeX);
|
main_menu();
|
||||||
dprint( 1, 30, C_BLACK, "planeY : %d", planeY);
|
}
|
||||||
dprint( 1, 40, C_BLACK, "dirX : %d", dirX);
|
|
||||||
dprint( 1, 50, C_BLACK, "dirY : %d", dirY);
|
keys_get();
|
||||||
dprint( 1, 60, C_BLACK, "posX : %d", posX);
|
|
||||||
dprint( 1, 70, C_BLACK, "posY : %d", posY);
|
//if (disp_frame_time == 1) dprint( 1, 10, C_BLACK, "Frame time : %d ms", frame_time);
|
||||||
#endif
|
|
||||||
|
/*#ifdef debug
|
||||||
dupdate();
|
dprint( 1, 20, C_BLACK, "planeX : %d", planeX);
|
||||||
prof_leave(frame);
|
dprint( 1, 30, C_BLACK, "planeY : %d", planeY);
|
||||||
frame_time = (int)prof_time(frame)/1000;
|
dprint( 1, 40, C_BLACK, "dirX : %d", dirX);
|
||||||
first_frame = 0;
|
dprint( 1, 50, C_BLACK, "dirY : %d", dirY);
|
||||||
}
|
dprint( 1, 60, C_BLACK, "posX : %d", posX);
|
||||||
|
dprint( 1, 70, C_BLACK, "posY : %d", posY);
|
||||||
prof_quit();
|
#endif*/
|
||||||
|
|
||||||
//Libérez vos textures générées procéduralement
|
dupdate();
|
||||||
|
//prof_leave(frame);
|
||||||
image_free(tex_index[0]);
|
//frame_time = (int)prof_time(frame)/1000;
|
||||||
image_free(tex_index[3]);
|
first_frame = 0;
|
||||||
|
}
|
||||||
return 1;
|
|
||||||
}
|
//prof_quit();
|
||||||
|
|
||||||
|
//Libérez vos textures générées procéduralement
|
||||||
|
|
||||||
|
//image_free(tex_index[0]);
|
||||||
|
//image_free(tex_index[3]);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
39
src/moteur.c
39
src/moteur.c
|
@ -2,15 +2,20 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
//#include <string.h>
|
||||||
#include <time.h>
|
//#include <time.h>
|
||||||
|
|
||||||
#include <gint/display.h>
|
#include <omega/display.h>
|
||||||
#include <gint/keyboard.h>
|
#include <omega/keyboard.h>
|
||||||
#include <libprof.h>
|
|
||||||
|
//#include <gint/display.h>
|
||||||
|
//#include <gint/keyboard.h>
|
||||||
|
//#include <libprof.h>
|
||||||
|
|
||||||
#include "fixed.h"
|
#include "fixed.h"
|
||||||
|
|
||||||
|
//#include "keycodes.h"
|
||||||
|
|
||||||
#include "moteur.h"
|
#include "moteur.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
|
@ -86,7 +91,7 @@ void move() {
|
||||||
if (dirX < -0xFFFF) dirX = -0xFFFF;
|
if (dirX < -0xFFFF) dirX = -0xFFFF;
|
||||||
if (dirY < -0xFFFF) dirY = -0xFFFF;
|
if (dirY < -0xFFFF) dirY = -0xFFFF;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void spawn_gen(){
|
void spawn_gen(){
|
||||||
extern fixed_t posX;
|
extern fixed_t posX;
|
||||||
extern fixed_t posY;
|
extern fixed_t posY;
|
||||||
|
@ -164,16 +169,16 @@ void spawn_gen(){
|
||||||
|
|
||||||
void load_map(){
|
void load_map(){
|
||||||
spawn_gen();
|
spawn_gen();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void draw_walls(image_t *frame_buffer){
|
void draw_walls(){
|
||||||
extern fixed_t posX;
|
extern fixed_t posX;
|
||||||
extern fixed_t posY;
|
extern fixed_t posY;
|
||||||
extern fixed_t dirX;
|
extern fixed_t dirX;
|
||||||
extern fixed_t dirY;
|
extern fixed_t dirY;
|
||||||
extern fixed_t planeX;
|
extern fixed_t planeX;
|
||||||
extern fixed_t planeY;
|
extern fixed_t planeY;
|
||||||
extern image_t *tex_index[TINDEX_S];
|
//extern image_t *tex_index[TINDEX_S];
|
||||||
extern char map_test[map_w][map_h];
|
extern char map_test[map_w][map_h];
|
||||||
|
|
||||||
fixed_t cameraX;
|
fixed_t cameraX;
|
||||||
|
@ -199,7 +204,7 @@ void draw_walls(image_t *frame_buffer){
|
||||||
int v_offset = 0; //(int)(sin(f2int(posX + posY)) * 5); //a raffiner un peu
|
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);
|
fixed_t h_offset = 0; //fix(sin(f2int(posX - posY)) * 0.01);
|
||||||
|
|
||||||
struct image_linear_map temp;
|
//struct image_linear_map temp;
|
||||||
|
|
||||||
for(x = 0; x < viewport_w; x++) {
|
for(x = 0; x < viewport_w; x++) {
|
||||||
|
|
||||||
|
@ -253,7 +258,7 @@ void draw_walls(image_t *frame_buffer){
|
||||||
sideDistY = fmul( fix(mapY + 1) - posY, deltaDistY);
|
sideDistY = fmul( fix(mapY + 1) - posY, deltaDistY);
|
||||||
}
|
}
|
||||||
//perform DDA
|
//perform DDA
|
||||||
while(true) {
|
while(1) {
|
||||||
//Check if the ray is out of range/bounds
|
//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) {
|
if (sideDistX >= max_dist || sideDistY >= max_dist || mapX < 0 || mapY < 0 || mapX >= map_w || mapY >= map_h) {
|
||||||
break;
|
break;
|
||||||
|
@ -314,12 +319,16 @@ void draw_walls(image_t *frame_buffer){
|
||||||
texSample = 64;
|
texSample = 64;
|
||||||
texSampleY = 0;
|
texSampleY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int linePos = viewport_h * 0.5 - lineHeight * 0.5;
|
||||||
|
|
||||||
|
dline(x, linePos, x, linePos+lineHeight, 0xFAFA);
|
||||||
|
|
||||||
image_t texStripe;
|
//image_t texStripe;
|
||||||
|
|
||||||
texStripe = *image_sub(tex_index[map_test[mapX][mapY]], texX, texSampleY, 1, texSample);
|
//texStripe = *image_sub(tex_index[map_test[mapX][mapY]], texX, texSampleY, 1, texSample);
|
||||||
|
|
||||||
image_scale(&texStripe, 0xFFFF, texSize, &temp);
|
//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);
|
//image_linear(&texStripe, image_at(frame_buffer, x, (int)(viewport_h * 0.5 - lineHeight * 0.5) + v_offset), &temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef moteur_h
|
#ifndef moteur_h
|
||||||
#define moteur_h
|
#define moteur_h
|
||||||
|
|
||||||
#include <gint/image.h>
|
//#include <gint/image.h>
|
||||||
|
|
||||||
//param. graphiques
|
//param. graphiques
|
||||||
#define screen_w 396
|
#define screen_w 396
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
void load_map();
|
void load_map();
|
||||||
void end_screen();
|
void end_screen();
|
||||||
void draw_walls(image_t *frame_buffer);
|
void draw_walls();
|
||||||
void move();
|
void move();
|
||||||
|
|
||||||
#endif /* moteur */
|
#endif /* moteur */
|
||||||
|
|
Loading…
Reference in a new issue