Compare commits
2 Commits
36bce711cc
...
a1ef2e7ba0
Author | SHA1 | Date |
---|---|---|
Sylvain PILLOT | a1ef2e7ba0 | |
Sylvain PILLOT | 32deb536c9 |
|
@ -1,6 +1,7 @@
|
|||
# Build files
|
||||
/build-fx
|
||||
/build-cg
|
||||
/build-cg-push
|
||||
/*.g1a
|
||||
/*.g3a
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ set(SOURCES
|
|||
# ...
|
||||
)
|
||||
set(ASSETS_cg
|
||||
assets-cg/font.png
|
||||
#assets-cg/font.png
|
||||
assets-cg/milifont.png
|
||||
|
||||
assets-cg/Sprites/Explosions/firstboom.png
|
||||
assets-cg/Sprites/Explosions/emp_circ.png
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,14 +0,0 @@
|
|||
{ "columns":32,
|
||||
"image":"tileset.png",
|
||||
"imageheight":1024,
|
||||
"imagewidth":512,
|
||||
"margin":0,
|
||||
"name":"Tileset_Space",
|
||||
"spacing":0,
|
||||
"tilecount":2048,
|
||||
"tiledversion":"1.8.0",
|
||||
"tileheight":16,
|
||||
"tilewidth":16,
|
||||
"type":"tileset",
|
||||
"version":"1.8"
|
||||
}
|
Binary file not shown.
|
@ -1,4 +1,8 @@
|
|||
*.png:
|
||||
type: bopti-image
|
||||
name_regex: (.*)\.png img_\1
|
||||
profile: p8_rgb565a
|
||||
milifont.png:
|
||||
name: milifont_prop
|
||||
type: font
|
||||
charset: print
|
||||
width: 3
|
||||
grid.size: 3x5
|
||||
grid.padding: 1
|
||||
proportional: true
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 537 B |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -10,7 +10,6 @@
|
|||
void azrp_starfield( void );
|
||||
void azrp_starfield_init( uint8_t nbstars );
|
||||
void azrp_starfield_close( void );
|
||||
void azrp_starfield_USBDEBUG( uint8_t info );
|
||||
|
||||
void azrp_tilesmap( int shifttile, int *tilemap, bopti_image_t *image, int tileset_size );
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "background.h"
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "bonus.h"
|
||||
#include <num/num.h>
|
||||
#include <gint/rtc.h>
|
||||
|
|
29
src/boss.cpp
29
src/boss.cpp
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "boss.h"
|
||||
#include "bullet.h"
|
||||
#include <cstdint>
|
||||
|
@ -13,6 +15,8 @@
|
|||
extern bopti_image_t img_Lifebar;
|
||||
extern bopti_image_t img_Boss1;
|
||||
|
||||
extern font_t milifont_prop;
|
||||
|
||||
|
||||
#define NB_PIECES_BOSS 12
|
||||
libnum::num XdataBossInternal[NB_PIECES_BOSS];
|
||||
|
@ -68,9 +72,9 @@ bool Is_Point_Inside_Triangle( int Px, int Py, int P1x, int P1y, int P2x, int P2
|
|||
|
||||
bool s_ab = (P2x - P1x) * as_y - (P2y - P1y) * as_x > 0;
|
||||
|
||||
if ((P3x - P1x) * as_y - (P3y - P1y) * as_x > 0 == s_ab)
|
||||
if (((P3x - P1x) * as_y - (P3y - P1y) * as_x > 0) == s_ab)
|
||||
return false;
|
||||
if ((P3x - P2x) * (Py - P2y) - (P3y - P2y)*(Px - P2x) > 0 != s_ab)
|
||||
if (((P3x - P2x) * (Py - P2y) - (P3y - P2y)*(Px - P2x) > 0) != s_ab)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -190,17 +194,34 @@ void Boss::Render( void )
|
|||
for( int i=0; i<NB_PIECES_BOSS; i++ )
|
||||
{
|
||||
if (Pieces[i*2].toberemoved == false)
|
||||
{
|
||||
azrp_triangle( (int) XdataBossExternal[ Pieces[i*2].P1 ], (int) YdataBossExternal[ Pieces[i*2].P1 ],
|
||||
(int) XdataBossExternal[ Pieces[i*2].P2 ], (int) YdataBossExternal[ Pieces[i*2].P2 ],
|
||||
(int) XdataBossInternal[ Pieces[i*2].P3 ], (int) YdataBossInternal[ Pieces[i*2].P3 ],
|
||||
Pieces[i*2].color );
|
||||
|
||||
#if(DEBUG_MODE)
|
||||
dfont( &milifont_prop );
|
||||
int X = (int) ((XdataBossExternal[ Pieces[i*2].P1 ] + XdataBossExternal[ Pieces[i*2].P2 ] + XdataBossInternal[ Pieces[i*2].P3 ]) / 3);
|
||||
int Y = (int) ((YdataBossExternal[ Pieces[i*2].P1 ] + YdataBossExternal[ Pieces[i*2].P2 ] + YdataBossInternal[ Pieces[i*2].P3 ]) / 3);
|
||||
azrp_print( X, Y, C_WHITE, "%d", Pieces[i*2].life );
|
||||
#endif
|
||||
|
||||
}
|
||||
if (Pieces[i*2+1].toberemoved == false)
|
||||
{
|
||||
azrp_triangle( (int) XdataBossInternal[ Pieces[i*2+1].P1 ], (int) YdataBossInternal[ Pieces[i*2+1].P1 ],
|
||||
(int) XdataBossInternal[ Pieces[i*2+1].P2 ], (int) YdataBossInternal[ Pieces[i*2+1].P2 ],
|
||||
(int) XdataBossExternal[ Pieces[i*2+1].P3 ], (int) YdataBossExternal[ Pieces[i*2+1].P3 ],
|
||||
Pieces[i*2+1].color );
|
||||
|
||||
|
||||
#if(DEBUG_MODE)
|
||||
dfont( &milifont_prop );;
|
||||
int X = (int) ((XdataBossInternal[ Pieces[i*2+1].P1 ] + XdataBossInternal[ Pieces[i*2+1].P2 ] + XdataBossExternal[ Pieces[i*2+1].P3 ]) / 3);
|
||||
int Y = (int) ((YdataBossInternal[ Pieces[i*2+1].P1 ] + YdataBossInternal[ Pieces[i*2+1].P2 ] + YdataBossExternal[ Pieces[i*2+1].P3 ]) / 3);
|
||||
azrp_print( X, Y, C_WHITE, "%d", Pieces[i*2+1].life );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
azrp_image_p8_effect(xmin, ymin, &img_Boss1, DIMAGE_NONE);
|
||||
|
@ -255,7 +276,7 @@ bool Boss::Test_Impact( Bullet *projectile )
|
|||
if (projectile->x >= xmin && projectile->x <= xmax && projectile->y >= ymin && projectile->y <= ymax )
|
||||
{
|
||||
life -= projectile->strength;
|
||||
if (life<0) toberemoved = true;
|
||||
if (life<0) this->toberemoved = true;
|
||||
projectile->toberemoved = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
typedef struct
|
||||
{
|
||||
uint8_t P1, P2, P3;
|
||||
uint16_t life;
|
||||
int16_t life;
|
||||
bool toberemoved;
|
||||
int color;
|
||||
} BossPart;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "bullet.h"
|
||||
|
||||
#include <azur/azur.h>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "collections.h"
|
||||
|
||||
#include <vector>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
|
||||
#define DEBUG_MODE 0
|
||||
#define USB 1
|
||||
#define MORE_RAM 0
|
||||
#define CALCEMU 0
|
||||
|
||||
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "enemy.h"
|
||||
#include "bullet.h"
|
||||
#include <num/num.h>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "extrakeyboard.h"
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/rtc.h>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "impact.h"
|
||||
|
||||
|
||||
|
|
93
src/main.cpp
93
src/main.cpp
|
@ -1,7 +1,4 @@
|
|||
#define DEBUG_MODE 0
|
||||
#define USB 1
|
||||
#define MORE_RAM 1
|
||||
#define CALCEMU 0
|
||||
#include "config.h"
|
||||
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
@ -95,42 +92,42 @@ Boss *MyBoss;
|
|||
KeyboardExtra MyKeyboard;
|
||||
|
||||
|
||||
static void hook_prefrag(int id, void *fragment, int size)
|
||||
{
|
||||
if(!screenshot && !record)
|
||||
return;
|
||||
|
||||
/* Screenshot takes precedence */
|
||||
char const *type = screenshot ? "image" : "video";
|
||||
|
||||
#if(USB)
|
||||
int pipe = usb_ff_bulk_output();
|
||||
static void hook_prefrag(int id, void *fragment, int size)
|
||||
{
|
||||
if(!screenshot && !record)
|
||||
return;
|
||||
|
||||
if(id == 0) {
|
||||
usb_fxlink_header_t h;
|
||||
usb_fxlink_image_t sh;
|
||||
int size = azrp_width * azrp_height * 2;
|
||||
|
||||
usb_fxlink_fill_header(&h, "fxlink", type, size + sizeof sh);
|
||||
sh.width = htole32(azrp_width);
|
||||
sh.height = htole32(azrp_height);
|
||||
sh.pixel_format = htole32(USB_FXLINK_IMAGE_RGB565);
|
||||
/* Screenshot takes precedence */
|
||||
char const *type = screenshot ? "image" : "video";
|
||||
|
||||
usb_write_sync(pipe, &h, sizeof h, false);
|
||||
usb_write_sync(pipe, &sh, sizeof sh, false);
|
||||
}
|
||||
int pipe = usb_ff_bulk_output();
|
||||
|
||||
usb_write_sync(pipe, fragment, size, false);
|
||||
if(id == 0) {
|
||||
usb_fxlink_header_t h;
|
||||
usb_fxlink_image_t sh;
|
||||
int size = azrp_width * azrp_height * 2;
|
||||
|
||||
if(id == azrp_frag_count - 1) {
|
||||
usb_commit_sync(pipe);
|
||||
screenshot = false;
|
||||
usb_fxlink_fill_header(&h, "fxlink", type, size + sizeof sh);
|
||||
sh.width = htole32(azrp_width);
|
||||
sh.height = htole32(azrp_height);
|
||||
sh.pixel_format = htole32(USB_FXLINK_IMAGE_RGB565);
|
||||
|
||||
usb_write_sync(pipe, &h, sizeof h, false);
|
||||
usb_write_sync(pipe, &sh, sizeof sh, false);
|
||||
}
|
||||
|
||||
usb_write_sync(pipe, fragment, size, false);
|
||||
|
||||
if(id == azrp_frag_count - 1) {
|
||||
usb_commit_sync(pipe);
|
||||
screenshot = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void update( float dt )
|
||||
{
|
||||
// all update stuff depending on time will be done here
|
||||
|
@ -167,23 +164,22 @@ static void update( float dt )
|
|||
MyEnemies.erase( MyEnemies.begin() + i );
|
||||
}
|
||||
|
||||
if (MyBoss)
|
||||
{
|
||||
if (MyBoss->toberemoved == true)
|
||||
{
|
||||
Bonus *b = new Bonus( (int) MyBoss->x, (int) MyBoss->y, rand() % 2 );
|
||||
MyBonuses.push_back( b );
|
||||
|
||||
Create_Explosion( (int) MyBoss->x, (int) MyBoss->y );
|
||||
delete( MyBoss );
|
||||
MyBoss=nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MyBoss)
|
||||
if (MyBoss!=nullptr)
|
||||
{
|
||||
MyBoss->Update( dt );
|
||||
|
||||
if (MyBoss->toberemoved == true)
|
||||
{
|
||||
Bonus *b = new Bonus( (int) MyBoss->x, (int) MyBoss->y, rand() % 2 );
|
||||
MyBonuses.push_back( b );
|
||||
|
||||
Create_Explosion( (int) MyBoss->x, (int) MyBoss->y );
|
||||
delete( MyBoss );
|
||||
MyBoss=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<MyParticles.size(); i++)
|
||||
|
@ -287,6 +283,9 @@ static void render( void )
|
|||
for(auto& e : MyEnemies)
|
||||
e->Render();
|
||||
|
||||
if (MyBoss!=nullptr)
|
||||
MyBoss->Render();
|
||||
|
||||
for( auto& i : MyImpacts)
|
||||
i->Render();
|
||||
|
||||
|
@ -479,7 +478,9 @@ int main(void)
|
|||
//azrp_shader_image_rgb16_configure();
|
||||
//azrp_shader_image_p8_configure();
|
||||
//azrp_shader_image_p4_configure();
|
||||
azrp_hook_set_prefrag(hook_prefrag);
|
||||
#if(USB)
|
||||
azrp_hook_set_prefrag(hook_prefrag);
|
||||
#endif
|
||||
|
||||
azrp_starfield_init( 250 );
|
||||
|
||||
|
@ -517,8 +518,6 @@ int main(void)
|
|||
// update as per the time spend to do the loop
|
||||
update( elapsedTime );
|
||||
|
||||
MyBoss->Update(elapsedTime);
|
||||
|
||||
// update the RAM consumption status
|
||||
#if(MORE_RAM)
|
||||
_uram_stats = kmalloc_get_gint_stats(_uram);
|
||||
|
@ -538,9 +537,7 @@ int main(void)
|
|||
|
||||
render();
|
||||
|
||||
MyBoss->Render();
|
||||
|
||||
azrp_update();
|
||||
azrp_update();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "particles.h"
|
||||
|
||||
#include <azur/azur.h>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "player.h"
|
||||
#include "bullet.h"
|
||||
#include "enemy.h"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <azur/gint/render.h>
|
||||
#include "MyAzurShaders.h"
|
||||
#include <cstdlib>
|
||||
|
@ -64,12 +66,6 @@ static void register_shader(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void azrp_starfield_USBDEBUG( uint8_t info )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void azrp_starfield_init( uint8_t nbstars )
|
||||
{
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <azur/gint/render.h>
|
||||
#include "MyAzurShaders.h"
|
||||
#include <cstdlib>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "trajectory.h"
|
||||
|
||||
Trajectory::Trajectory( )
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
||||
|
@ -6,10 +8,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <fxlibc/printf.h>
|
||||
|
||||
|
||||
extern font_t milifont_prop;
|
||||
|
||||
/* Render text with Azur images - quite bad, but I don't have time lol. */
|
||||
void Azur_draw_text(int x, int y, char const *fmt, ...)
|
||||
{
|
||||
char str[128];
|
||||
/* char str[128];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(str, 128, fmt, args);
|
||||
|
@ -24,4 +29,14 @@ void Azur_draw_text(int x, int y, char const *fmt, ...)
|
|||
int col = (str[i] - 32) & 15;
|
||||
azrp_subimage(x + 5 * i, y, &img_font, 7 * col + 1, 9 * row + 1, 6, 8, DIMAGE_NONE);
|
||||
}
|
||||
*/
|
||||
char str[128];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(str, 128, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
dfont( &milifont_prop );
|
||||
|
||||
azrp_text( x, y, C_WHITE, str );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue