Compare commits
5 Commits
907639ae1a
...
e6c1e93874
Author | SHA1 | Date |
---|---|---|
Sylvain PILLOT | e6c1e93874 | |
Sylvain PILLOT | 65c605bd96 | |
Sylvain PILLOT | 05d84dcb4d | |
Sylvain PILLOT | c9e7801f35 | |
Sylvain PILLOT | 28718ae6d0 |
|
@ -42,6 +42,7 @@ set(SOURCES
|
|||
src/enemy.cpp
|
||||
src/starfieldshader.cpp
|
||||
src/background.cpp
|
||||
src/bonus.cpp
|
||||
|
||||
src/point2D.cpp
|
||||
src/trajectory.cpp
|
||||
|
@ -55,6 +56,9 @@ set(ASSETS_cg
|
|||
assets-cg/Sprites/Explosions/emp_circ.png
|
||||
assets-cg/Sprites/Explosions/fill_circ.png
|
||||
|
||||
assets-cg/Sprites/Bonus/life_bonus.png
|
||||
assets-cg/Sprites/Bonus/sat_bonus.png
|
||||
|
||||
assets-cg/Sprites/Bullets/bullet_normal.png
|
||||
assets-cg/Sprites/Bullets/bullet_blue.png
|
||||
assets-cg/Sprites/Bullets/bullet_laser.png
|
||||
|
@ -78,7 +82,7 @@ fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
|||
|
||||
add_executable(shmup ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_options(shmup PRIVATE -Wall -Wextra -Os -std=c++20)
|
||||
target_link_options(shmup PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage -fpermissive)
|
||||
target_link_options(shmup PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage -fno-use-cxa-atexit -fpermissive)
|
||||
target_link_libraries(shmup Azur::Azur -lnum LibProf::LibProf Gint::Gint -lstdc++)
|
||||
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
|
|
24
TODO.txt
24
TODO.txt
|
@ -11,22 +11,38 @@ The SHMUP Todo list :
|
|||
- interaction avec le décors (collisions possibles avec certaines tiles) qui imposent donc de suivre un "chemin" dans le niveau
|
||||
- multiple layers de tiles pour avoir des niveaux plus beaux
|
||||
|
||||
Partie mouvement :
|
||||
# Partie mouvement :
|
||||
- améliorer le système de trajectoires sur base de Splines pour rendre la vitesse des ennemis plus constante.
|
||||
- rendre les satellites sur une trajectoire (possibilité d'avoir des patterns plus complexes)
|
||||
- possibilité de transformer les trajectoires (grossissement/rétrécissement, translation et rotation)
|
||||
|
||||
Partie interaction / gameplay :
|
||||
# Partie interaction / gameplay :
|
||||
- implémenter les tirs ennemis (avec une IA minimale)
|
||||
- implémenter les hits des tirs ennemis sur le joueur
|
||||
- implémenter les collisions avec les ennemies
|
||||
- implémenter les collisions de bullets avec les satellites pour que ceux-ci perdent de la vie aussi
|
||||
- implémenter le tir des satellites
|
||||
- implémenter un système de bonus (points, upgrade tir/satellites/... )
|
||||
|
||||
Autres :
|
||||
# Bosses
|
||||
- Créer des bosses avec différentes zones, mobiles les unes par rapport aux autres
|
||||
- Créer des hitboxes pour chacune des zones du boss avec différentes sensibilités (par exemple le coeur/générateur = zone critique, mais mieux défendues)
|
||||
- Créer des protections des certaines zones qui peuvent "sauter" (boucliers qui s'usent)
|
||||
|
||||
# Autres :
|
||||
- plein de trucs dont boss "multi-morceaux et multi-hitboxes"
|
||||
- création de différents levels
|
||||
- créations de différents ennemis
|
||||
- créations de différents boss
|
||||
- créations de différentes armes
|
||||
- créations de différents bonus
|
||||
- créations de différents bonus
|
||||
- création de shields pour se protéger
|
||||
|
||||
# Modes spéciaux
|
||||
- mode menu avec différentes planètes à selectionner pour les différents niveaux
|
||||
- mode hyperspace travel pour les transitions :
|
||||
- sous mode : à la "tie fighter" ?
|
||||
- sous mode : éviter les astéroïdes
|
||||
- sous mode classique shmup horizontal
|
||||
- sous mode classiqie shmup vertical
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
*.png:
|
||||
type: bopti-image
|
||||
name_regex: (.*)\.png img_\1
|
||||
section: .data
|
||||
profile: p8_rgb565a
|
Binary file not shown.
After Width: | Height: | Size: 130 B |
Binary file not shown.
After Width: | Height: | Size: 137 B |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,92 @@
|
|||
#include "bonus.h"
|
||||
#include <num/num.h>
|
||||
#include <gint/rtc.h>
|
||||
|
||||
extern bopti_image_t img_emp_circ;
|
||||
extern bopti_image_t img_life_bonus;
|
||||
extern bopti_image_t img_sat_bonus;
|
||||
|
||||
Bonus::Bonus( int16_t _x, int16_t _y, uint8_t _id )
|
||||
{
|
||||
x = libnum::num( _x );
|
||||
y = libnum::num( _y );
|
||||
|
||||
ID = _id;
|
||||
|
||||
if (ID==0)
|
||||
{
|
||||
width = img_life_bonus.width/2;
|
||||
height = img_life_bonus.height/2;
|
||||
speed = 0;
|
||||
}
|
||||
else if (ID==1)
|
||||
{
|
||||
width = img_sat_bonus.width/2;
|
||||
height = img_sat_bonus.height/2;
|
||||
speed = 0;
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
xmax = (int) x + width;
|
||||
ymin = (int) y - height;
|
||||
ymax = (int) y + height;
|
||||
|
||||
toberemoved = false;
|
||||
|
||||
currentframe = libnum::num(0);
|
||||
|
||||
}
|
||||
|
||||
Bonus::~Bonus()
|
||||
{
|
||||
if (hasTrajectory)
|
||||
delete(pathToFollow);
|
||||
}
|
||||
|
||||
void Bonus::Update( float dt )
|
||||
{
|
||||
if (!hasTrajectory)
|
||||
{
|
||||
/*
|
||||
libnum::num a = libnum::num( dt / 60000.0f );
|
||||
x += a * libnum::num( dirx * speed );
|
||||
y += a * libnum::num( diry * speed );
|
||||
|
||||
if (x<width || x>azrp_width-width) dirx=-1*dirx;
|
||||
if (y<height || y>azrp_height-height) diry=-1*diry;
|
||||
*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pathToFollow->CalculatePosition( dt, speed, true, &x, &y );
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
xmax = (int) x + width;
|
||||
ymin = (int) y - height;
|
||||
ymax = (int) y + height;
|
||||
|
||||
libnum::num a = libnum::num( dt / 150000.0f );
|
||||
currentframe += a;
|
||||
|
||||
if (currentframe >7 ) currentframe = libnum::num(0);
|
||||
}
|
||||
|
||||
void Bonus::Render( void )
|
||||
{
|
||||
|
||||
uint8_t dximg = (int) currentframe * 15;
|
||||
uint8_t sz = (int) currentframe;
|
||||
|
||||
azrp_subimage_p8( (int) x-sz, (int) y-sz, &img_emp_circ, dximg+7-sz, 7-sz, sz*2+1, sz*2+1, DIMAGE_NONE );
|
||||
|
||||
if (ID==0)
|
||||
{
|
||||
azrp_image_p8_effect(xmin, ymin, &img_life_bonus, DIMAGE_NONE);
|
||||
}
|
||||
else if (ID==1)
|
||||
{
|
||||
azrp_image_p8_effect(xmin, ymin, &img_sat_bonus, DIMAGE_NONE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef BONUS_H
|
||||
#define BONUS_H
|
||||
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <num/num.h>
|
||||
#include "trajectory.h"
|
||||
|
||||
|
||||
class Bonus
|
||||
{
|
||||
public:
|
||||
Bonus( int16_t _x, int16_t _y, uint8_t _id );
|
||||
~Bonus();
|
||||
|
||||
void Update( float dt );
|
||||
void Render( void );
|
||||
|
||||
libnum::num x, y; // center position of the ennemy
|
||||
uint8_t width, height; // width and height -for the hitbox
|
||||
int16_t xmin, xmax, ymin, ymax; // square hitbox (to speed up the collision calculations)
|
||||
uint8_t ID;
|
||||
uint8_t speed;
|
||||
bool toberemoved;
|
||||
|
||||
bool hasTrajectory = false;
|
||||
Trajectory *pathToFollow;
|
||||
|
||||
private:
|
||||
int8_t dirx, diry;
|
||||
libnum::num currentframe;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
208
src/main.cpp
208
src/main.cpp
|
@ -1,4 +1,6 @@
|
|||
#define DEBUG_MODE 1
|
||||
#define DEBUG_MODE 0
|
||||
#define USB 1
|
||||
#define MORE_RAM 1
|
||||
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
@ -6,11 +8,17 @@
|
|||
#include <gint/rtc.h>
|
||||
|
||||
#include <gint/clock.h>
|
||||
#include <gint/kmalloc.h>
|
||||
|
||||
#if(MORE_RAM)
|
||||
#include <gint/kmalloc.h>
|
||||
#endif
|
||||
|
||||
#include <libprof.h>
|
||||
#include <gint/usb.h>
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
|
||||
#if(USB)
|
||||
#include <gint/usb.h>
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -32,7 +40,7 @@
|
|||
#include "particles.h"
|
||||
#include "bullet.h"
|
||||
#include "enemy.h"
|
||||
|
||||
#include "bonus.h"
|
||||
#include "impact.h"
|
||||
#include "background.h"
|
||||
|
||||
|
@ -61,21 +69,22 @@ uint8_t texttodraw=1;
|
|||
|
||||
|
||||
float elapsedTime = 0.0f;
|
||||
uint32_t time_update=0, time_render=0;
|
||||
uint32_t time_update=0, time_render=0;
|
||||
prof_t perf_update, perf_render;
|
||||
|
||||
|
||||
static kmalloc_arena_t extended_ram = { 0 };
|
||||
static kmalloc_arena_t *_uram;
|
||||
kmalloc_gint_stats_t *_uram_stats;
|
||||
kmalloc_gint_stats_t *extram_stats;
|
||||
|
||||
#if(MORE_RAM)
|
||||
static kmalloc_arena_t extended_ram = { 0 };
|
||||
static kmalloc_arena_t *_uram;
|
||||
kmalloc_gint_stats_t *_uram_stats;
|
||||
kmalloc_gint_stats_t *extram_stats;
|
||||
#endif
|
||||
|
||||
std::vector<Particle*> MyParticles;
|
||||
std::vector<Bullet*> MyPlayerBullets;
|
||||
std::vector<Bullet*> MyEnemiesBullets;
|
||||
std::vector<Enemy*> MyEnemies;
|
||||
std::vector<Impact*> MyImpacts;
|
||||
std::vector<Bonus*> MyBonuses;
|
||||
|
||||
Background MyBackground;
|
||||
|
||||
|
@ -92,6 +101,7 @@ static void hook_prefrag(int id, void *fragment, int size)
|
|||
/* Screenshot takes precedence */
|
||||
char const *type = screenshot ? "image" : "video";
|
||||
|
||||
#if(USB)
|
||||
int pipe = usb_ff_bulk_output();
|
||||
|
||||
if(id == 0) {
|
||||
|
@ -104,16 +114,18 @@ static void hook_prefrag(int id, void *fragment, int size)
|
|||
sh.height = htole32(azrp_height);
|
||||
sh.pixel_format = htole32(USB_FXLINK_IMAGE_RGB565);
|
||||
|
||||
usb_write_sync(pipe, &h, sizeof h, 4, false);
|
||||
usb_write_sync(pipe, &sh, sizeof sh, 4, false);
|
||||
usb_write_sync(pipe, &h, sizeof h, false);
|
||||
usb_write_sync(pipe, &sh, sizeof sh, false);
|
||||
}
|
||||
|
||||
usb_write_sync(pipe, fragment, size, 4, false);
|
||||
usb_write_sync(pipe, fragment, size, false);
|
||||
|
||||
if(id == azrp_frag_count - 1) {
|
||||
usb_commit_sync(pipe);
|
||||
screenshot = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,11 +135,10 @@ static void update( float dt )
|
|||
|
||||
MyPlayer->Update( dt );
|
||||
|
||||
|
||||
for(unsigned int i=0; i<MyImpacts.size(); i++)
|
||||
{
|
||||
MyImpacts[i]->Update( dt );
|
||||
|
||||
|
||||
// Check if the property toberemoved has been set to "true" for particle deletion
|
||||
if (MyImpacts[i]->toberemoved == true)
|
||||
{
|
||||
|
@ -139,13 +150,16 @@ static void update( float dt )
|
|||
for(unsigned int i=0; i<MyEnemies.size(); i++)
|
||||
{
|
||||
MyEnemies[i]->Update( dt );
|
||||
|
||||
|
||||
// Check if there is a collision with the current enemy
|
||||
//MyPlayer->Test_Collision( MyEnemies[i] );
|
||||
|
||||
// Check if the property toberemoved has been set to "true" for particle deletion
|
||||
if (MyEnemies[i]->toberemoved == true)
|
||||
{
|
||||
Bonus *b = new Bonus( (int) MyEnemies[i]->x, (int) MyEnemies[i]->y, rand() % 2 );
|
||||
MyBonuses.push_back( b );
|
||||
|
||||
Create_Explosion( (int) MyEnemies[i]->x, (int) MyEnemies[i]->y );
|
||||
delete( MyEnemies[i] );
|
||||
MyEnemies.erase( MyEnemies.begin() + i );
|
||||
|
@ -164,7 +178,6 @@ static void update( float dt )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i=0; i<MyPlayerBullets.size(); i++)
|
||||
{
|
||||
MyPlayerBullets[i]->Update( dt );
|
||||
|
@ -192,7 +205,6 @@ static void update( float dt )
|
|||
|
||||
if(MyPlayer->Test_Impact(MyEnemiesBullets[i])==true)
|
||||
{
|
||||
//TODO : we can create a list of impacts here, to be rendered later on
|
||||
Create_Impact( (int) MyEnemiesBullets[i]->x, (int) MyEnemiesBullets[i]->y );
|
||||
}
|
||||
|
||||
|
@ -205,6 +217,23 @@ static void update( float dt )
|
|||
}
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<MyBonuses.size(); i++)
|
||||
{
|
||||
MyBonuses[i]->Update( dt );
|
||||
|
||||
if (MyPlayer->Test_Impact(MyBonuses[i]) == true)
|
||||
{
|
||||
|
||||
// TODO : put stuff to highlight the bonus
|
||||
|
||||
}
|
||||
|
||||
if (MyBonuses[i]->toberemoved == true)
|
||||
{
|
||||
delete( MyBonuses[i] );
|
||||
MyBonuses.erase( MyBonuses.begin() + i );
|
||||
}
|
||||
}
|
||||
|
||||
MyBackground.Update( dt );
|
||||
|
||||
|
@ -218,7 +247,7 @@ static void render( void )
|
|||
{
|
||||
|
||||
if (drawstars) azrp_starfield();
|
||||
|
||||
|
||||
if (drawback) MyBackground.Render( );
|
||||
|
||||
for(auto& b : MyPlayerBullets)
|
||||
|
@ -236,6 +265,9 @@ static void render( void )
|
|||
for(auto& p : MyParticles)
|
||||
p->Render();
|
||||
|
||||
for(auto& b : MyBonuses)
|
||||
b->Render();
|
||||
|
||||
MyPlayer->Render();
|
||||
|
||||
|
||||
|
@ -243,14 +275,16 @@ static void render( void )
|
|||
if (texttodraw>=1) Azur_draw_text(1,01, "FPS = %.0f", (float) (1000000.0f / elapsedTime) );
|
||||
//if (texttodraw>=1) Azur_draw_text(1,11, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() );
|
||||
//if (texttodraw>=1 && !MyEnemies.empty()) Azur_draw_text(1,21, "Ennmy Life= %d", MyEnemies[0]->life );
|
||||
|
||||
|
||||
if (texttodraw>=2) Azur_draw_text(1,31, "Update = %.3f ms", (float) time_update / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text(1,41, "Render = %.3f ms", (float) time_render / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text(1,51, ">Total = %.0f ms", (float) elapsedTime / 1000.0f );
|
||||
|
||||
if (texttodraw>=3) Azur_draw_text(1,81, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,91, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,101, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
|
||||
#if(MORE_RAM)
|
||||
if (texttodraw>=3) Azur_draw_text(1,81, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,91, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,101, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -279,13 +313,13 @@ static void get_inputs( float dt )
|
|||
if (MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyHoldPressed(MYKEY_EXIT)) {exitToOS = true; };
|
||||
|
||||
|
||||
#if(DEBUG_MODE)
|
||||
#if(USB)
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_7) && usb_is_open() ) {screenshot = true;};
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_8) && usb_is_open()) {record = true; };
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_9) && usb_is_open()) {record = false; };
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_DEL) && usb_is_open()) {textoutput = true;};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) {texttodraw=0;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {texttodraw=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {texttodraw=2;}
|
||||
|
@ -294,7 +328,7 @@ static void get_inputs( float dt )
|
|||
{
|
||||
azrp_starfield_close( );
|
||||
azrp_starfield_init( 250 );
|
||||
}
|
||||
}
|
||||
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_LEFT)) { MyPlayer->Go_Left( dt ); }
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_RIGHT)) { MyPlayer->Go_Right( dt ); }
|
||||
|
@ -306,55 +340,64 @@ static void get_inputs( float dt )
|
|||
|
||||
bool AddMoreRAM( void )
|
||||
{
|
||||
/* allow more RAM */
|
||||
char const *osv = (char*) 0x80020020;
|
||||
#if(MORE_RAM)
|
||||
|
||||
if((!strncmp(osv, "03.", 3) && osv[3] <= '6') && gint[HWCALC] == HWCALC_FXCG50) // CG-50
|
||||
{
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
extended_ram.start = (void *)0x8c200000;
|
||||
extended_ram.end = (void *)0x8c4e0000 ;
|
||||
/* allow more RAM */
|
||||
char const *osv = (char*) 0x80020020;
|
||||
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return true;
|
||||
}
|
||||
else if (gint[HWCALC] == HWCALC_PRIZM) // CG-10/20
|
||||
{
|
||||
if((!strncmp(osv, "03.", 3) && osv[3] <= '6') && gint[HWCALC] == HWCALC_FXCG50) // CG-50
|
||||
{
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
extended_ram.start = (void *)0x8c200000;
|
||||
extended_ram.end = (void *)0x8c4e0000 ;
|
||||
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return true;
|
||||
}
|
||||
else if (gint[HWCALC] == HWCALC_PRIZM) // CG-10/20
|
||||
{
|
||||
|
||||
uint16_t *vram1, *vram2;
|
||||
dgetvram(&vram1, &vram2);
|
||||
dsetvram(vram1, vram1);
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
|
||||
extended_ram.start = vram2;
|
||||
extended_ram.end = (char *)vram2 + 396*224*2;
|
||||
uint16_t *vram1, *vram2;
|
||||
dgetvram(&vram1, &vram2);
|
||||
dsetvram(vram1, vram1);
|
||||
|
||||
extended_ram.start = vram2;
|
||||
extended_ram.end = (char *)vram2 + 396*224*2;
|
||||
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return false;
|
||||
|
||||
}
|
||||
else if (gint[HWCALC] == HWCALC_FXCG_MANAGER) // CG-50 EMULATOR
|
||||
{
|
||||
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
extended_ram.start = (void *)0x88200000;
|
||||
extended_ram.end = (void *)0x884e0000 ;
|
||||
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return false;
|
||||
|
||||
}
|
||||
else if (gint[HWCALC] == HWCALC_FXCG_MANAGER) // CG-50 EMULATOR
|
||||
{
|
||||
|
||||
extended_ram.name = "extram";
|
||||
extended_ram.is_default = true;
|
||||
extended_ram.start = (void *)0x88200000;
|
||||
extended_ram.end = (void *)0x884e0000 ;
|
||||
|
||||
kmalloc_init_arena(&extended_ram, true);
|
||||
kmalloc_add_arena(&extended_ram );
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void FreeMoreRAM( void )
|
||||
{
|
||||
memset(extended_ram.start, 0, (char *)extended_ram.end - (char *)extended_ram.start);
|
||||
#if(MORE_RAM)
|
||||
memset(extended_ram.start, 0, (char *)extended_ram.end - (char *)extended_ram.start);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -382,7 +425,9 @@ int main(void)
|
|||
{
|
||||
exitToOS = false;
|
||||
|
||||
_uram = kmalloc_get_arena("_uram");
|
||||
#if(MORE_RAM)
|
||||
_uram = kmalloc_get_arena("_uram");
|
||||
#endif
|
||||
|
||||
bool canWeAllocate3Mb = AddMoreRAM();
|
||||
|
||||
|
@ -390,10 +435,10 @@ int main(void)
|
|||
__printf_enable_fixed();
|
||||
|
||||
azrp_config_scale(SCALE_PIXEL);
|
||||
azrp_shader_clear_configure();
|
||||
azrp_shader_image_rgb16_configure();
|
||||
azrp_shader_image_p8_configure();
|
||||
azrp_shader_image_p4_configure();
|
||||
//azrp_shader_clear_configure();
|
||||
//azrp_shader_image_rgb16_configure();
|
||||
//azrp_shader_image_p8_configure();
|
||||
//azrp_shader_image_p4_configure();
|
||||
azrp_hook_set_prefrag(hook_prefrag);
|
||||
|
||||
azrp_starfield_init( 250 );
|
||||
|
@ -408,8 +453,10 @@ int main(void)
|
|||
#endif
|
||||
*/
|
||||
|
||||
#if(USB)
|
||||
usb_interface_t const *interfaces[] = { &usb_ff_bulk, NULL };
|
||||
usb_open(interfaces, GINT_CALL_NULL);
|
||||
#endif
|
||||
|
||||
prof_init();
|
||||
|
||||
|
@ -429,8 +476,10 @@ int main(void)
|
|||
update( elapsedTime );
|
||||
|
||||
// update the RAM consumption status
|
||||
_uram_stats = kmalloc_get_gint_stats(_uram);
|
||||
extram_stats = kmalloc_get_gint_stats(&extended_ram);
|
||||
#if(MORE_RAM)
|
||||
_uram_stats = kmalloc_get_gint_stats(_uram);
|
||||
extram_stats = kmalloc_get_gint_stats(&extended_ram);
|
||||
#endif
|
||||
}
|
||||
|
||||
prof_leave(perf_update);
|
||||
|
@ -462,11 +511,8 @@ int main(void)
|
|||
|
||||
char texttosend[1024];
|
||||
|
||||
for(int i=-720; i<=720; i++)
|
||||
{
|
||||
sprintf( texttosend, "i=%d - Sin(i)=%f - Cos(i)=%f - Tan(i)=%f\n", i, (float) FastSinInt(i), (float) FastCosInt(i), (float) FastTanInt(i) );
|
||||
usb_fxlink_text(texttosend, 0);
|
||||
}
|
||||
sprintf( texttosend, "%s", "Hello !!!" );
|
||||
usb_fxlink_text(texttosend, 0);
|
||||
|
||||
textoutput = false;
|
||||
}
|
||||
|
@ -482,8 +528,10 @@ int main(void)
|
|||
|
||||
|
||||
prof_quit();
|
||||
usb_close();
|
||||
|
||||
#if(USB)
|
||||
usb_close();
|
||||
#endif
|
||||
|
||||
FreeMoreRAM( );
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ extern bopti_image_t img_mainship1;
|
|||
extern bopti_image_t img_Satellite_Lvl1;
|
||||
extern Background MyBackground;
|
||||
|
||||
|
||||
Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
||||
{
|
||||
x = libnum::num(_x);
|
||||
|
@ -37,7 +36,7 @@ Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
|||
|
||||
satellites = true;
|
||||
satLevel = 1;
|
||||
satNumber = 6;
|
||||
satNumber = 3;
|
||||
satAngle = 0;
|
||||
satRadius = 50;
|
||||
satSpeed = 2;
|
||||
|
@ -106,6 +105,19 @@ bool Player::Test_Impact( Bullet *projectile )
|
|||
else return false;
|
||||
}
|
||||
|
||||
bool Player::Test_Impact( Bonus *bonus )
|
||||
{
|
||||
if (bonus->x >= xmin && bonus->x <= xmax && bonus->y >= ymin && bonus->y <= ymax )
|
||||
{
|
||||
if (bonus->ID==0) life = 1000;
|
||||
else if (bonus->ID==1) satNumber++;
|
||||
|
||||
bonus->toberemoved = true;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Player::Test_Collision( Enemy *adverseship )
|
||||
{
|
||||
if (adverseship->xmax >= xmin && adverseship->xmin <= xmax && adverseship->ymax >= ymin && adverseship->ymin <= ymax )
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <num/num.h>
|
||||
#include "bullet.h"
|
||||
#include "enemy.h"
|
||||
|
||||
#include "bonus.h"
|
||||
|
||||
class Player
|
||||
{
|
||||
|
@ -21,7 +21,8 @@ class Player
|
|||
void Update( float dt );
|
||||
void Render( void );
|
||||
|
||||
bool Test_Impact( Bullet *projectile );
|
||||
bool Test_Impact( Bullet *projectile );
|
||||
bool Test_Impact( Bonus *bonus );
|
||||
bool Test_Collision( Enemy *adverseship );
|
||||
void Set_Speed( uint8_t _sp );
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <cstdio>
|
||||
|
||||
#include <gint/rtc.h>
|
||||
#include <gint/usb.h>
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -52,42 +50,23 @@ std::vector<particle*> pixels;
|
|||
std::vector<star*> starfield;
|
||||
|
||||
|
||||
__attribute__((constructor))
|
||||
static void register_shader(void)
|
||||
{
|
||||
extern azrp_shader_t azrp_shader_starfield;
|
||||
AZRP_SHADER_STARFIELD = azrp_register_shader(azrp_shader_starfield);
|
||||
}
|
||||
|
||||
|
||||
void azrp_shader_starfield_configure(void)
|
||||
static void azrp_shader_starfield_configure(void)
|
||||
{
|
||||
azrp_set_uniforms(AZRP_SHADER_STARFIELD, (void *)azrp_width);
|
||||
}
|
||||
|
||||
|
||||
__attribute__((constructor))
|
||||
static void register_shader(void)
|
||||
{
|
||||
extern azrp_shader_t azrp_shader_starfield;
|
||||
AZRP_SHADER_STARFIELD = azrp_register_shader(azrp_shader_starfield, azrp_shader_starfield_configure );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void azrp_starfield_USBDEBUG( uint8_t info )
|
||||
{
|
||||
char texttosend[1024];
|
||||
|
||||
int nbpixelcumulated = 0;
|
||||
|
||||
if (info==SHOW_PIXELS)
|
||||
for(unsigned int i=0; i<pixels.size(); i++)
|
||||
{
|
||||
sprintf( texttosend, "Pixel %d : x=%d : y=%d : s=%d : f=%d : c=%d : o=%d\n", i, pixels[i]->x, pixels[i]->y, pixels[i]->s, pixels[i]->frag, pixels[i]->c, pixels[i]->off );
|
||||
usb_fxlink_text(texttosend, 0);
|
||||
}
|
||||
else if (info==SHOW_STARS)
|
||||
for(unsigned int i=0; i<starfield.size(); i++)
|
||||
{
|
||||
if (starfield[i]->n==1 || starfield[i]->n==2) nbpixelcumulated+=4;
|
||||
else if (starfield[i]->n==3) nbpixelcumulated+=9;
|
||||
else if (starfield[i]->n==4) nbpixelcumulated+=21;
|
||||
|
||||
sprintf( texttosend, "Star %d : x=%d : y=%d : s=%d : n=%d : t=%d : cumul=%d\n", i, starfield[i]->x, starfield[i]->y, starfield[i]->s, starfield[i]->n, starfield[i]->t, nbpixelcumulated );
|
||||
usb_fxlink_text(texttosend, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,11 +252,21 @@ void azrp_starfield( void )
|
|||
{
|
||||
prof_enter(azrp_perf_cmdgen);
|
||||
|
||||
struct command cmd;
|
||||
cmd.shader_id = AZRP_SHADER_STARFIELD;
|
||||
cmd.current_frag = 0;
|
||||
cmd.nbpixel = pixels.size();
|
||||
cmd.data = pixels.data();
|
||||
int fragmin = 0;
|
||||
int fragcount = (223 >> 4) + 1;
|
||||
|
||||
|
||||
|
||||
struct command *cmd = (struct command *) azrp_new_command(sizeof *cmd, fragmin, fragcount);
|
||||
if(!cmd) {
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
return;
|
||||
}
|
||||
|
||||
cmd->shader_id = AZRP_SHADER_STARFIELD;
|
||||
cmd->current_frag = 0;
|
||||
cmd->nbpixel = pixels.size();
|
||||
cmd->data = pixels.data();
|
||||
|
||||
for(unsigned int i=0; i<pixels.size(); i++)
|
||||
{
|
||||
|
@ -286,10 +275,6 @@ void azrp_starfield( void )
|
|||
pixels[i]->off = pixels[i]->y & 15;
|
||||
}
|
||||
|
||||
int fragmin = 0;
|
||||
int fragcount = (223 >> 4) + 1;
|
||||
|
||||
azrp_queue_command(&cmd, sizeof cmd, fragmin, fragcount);
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include <cstdio>
|
||||
|
||||
#include <gint/rtc.h>
|
||||
#include <gint/usb.h>
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue