0 Members and 3 Guests are viewing this topic.
typedef struct { int health; int magic;} enemy;enemy[] Bestiary = {enemy = {2,4}, enemy = {3,6}}
#define byte[] unsigned char[]#define new_string(name,value) byte[] name = value
typedef struct { int health; int health = this.health;} enemy;
struct point { int x; int y;} my_point; struct point *p = &my_point; // To declare p as a pointer of type struct point (*p).x = 8; // To access the first member of the structp->x = 8; // Another way to access the first member of the struct
struct point { int x; int y = this.x;} my_point;
struct point { int x; int y = x*2; //I'm pretty sure this will work and "y" will be twice x} my_point;
oh, okay, that's perfect that answers number 3, number 1 I finally found was true online (I can make an array of structs) and #2 seems okay and was probably stupid to ask about
/*All definitions for everything needed for ROL:AT are included here,sorted by type and meaning*///-----------------------// TECHNICAL THINGS//-----------------------#define string(name, value) byte name##[] = value#define clean_exit 0#define error_exit 1
#include "ROLAT_defs.h"#include "battle_system.c"int main() { battle_main(); return clean_exit;}
#include "keyboard_syscalls.h"#include "keyboard.hpp"#define LCD_WIDTH_PX 384 #define LCD_HEIGHT_PX 216#define MASK_RED 0xf800void CopySpriteMasked(const char*data, int x, int y, int width, int height, int maskcolor);int PRGM_GetKey(void);void CopySpriteMasked(const char*data, int x, int y, int width, int height, int maskcolor) { char* VRAM = (char*)0xA8000000; VRAM += 2*(LCD_WIDTH_PX*y + x); for(int j=y; j<y+height; j++) { for(int i=x; i<x+width; i++) { if ((((((int)(*data))&0x000000FF)<<8) | ((((int)(*(data+1))))&0x000000FF)) != maskcolor) { *(VRAM++) = *(data++); *(VRAM++) = *(data++); } else { VRAM += 2; data += 2; } } VRAM += 2*(LCD_WIDTH_PX-width); } }int PRGM_GetKey(){ unsigned char buffer[12]; PRGM_GetKey_OS( buffer ); return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 ); }
const char Nomekati[] = { 0xf8,0x00,0xf8 ... (you get it, though there's 3 colors: 0xf800 (RED), 0x0000 (white) and 0xFFFF (black) //goes on and on, it's a 64x64 image (troll face)};
#include "bestiary.c"#include "display_syscalls.h"#include "ROLAT_defs.h"#include "useful.c"#define endof_render_exit 2int render_status = clean_exit;int Current_Opponents_nums[] = {1,0,0,0,0,0};enemy Current_Opponents[6];int battle_main(void);int renderloop_bs(void);int battle_main() { for (int i=0;i<=5;i++) { if (Current_Opponents_nums[i] != 0) { CreateDynamicEnemy(&(Current_Opponents[i]), Current_Opponents_nums[i]); } } while (render_status == clean_exit) { render_status == renderloop_bs(); if (PRGM_GetKey()) { render_status = endof_render_exit; } } return (render_status == endof_render_exit) ? clean_exit : error_exit;}int renderloop_bs() { Bdisp_AllCr_VRAM(); CopySpriteMasked(Bestiary[1].sprite_data, 20, 20, Bestiary[1].width, Bestiary[1].height, MASK_RED); Bdisp_PutDisp_DD(); return clean_exit;}
#include "ROLAT_defs.h"#include "stdlib.h"#include "Enemies.c"#include "string.h"typedef struct { unsigned char name[9]; const void*sprite_data; unsigned short magic; unsigned char intelligence, hit, move_1, move_2, move_3; unsigned short attack, defense; unsigned char is_boss; unsigned char can_heal; unsigned char type; unsigned char orb_held; int width, height, gp, xp, hp, max_hp;} enemy; int ENEMY_SIZE = sizeof(enemy);void CreateDynamicEnemy(enemy*p, int bestiary_num);enemy Bestiary[] = {{"/0",(const char*)0x00000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{"Nomekati\0",Nomekati,0,0,0,200,15,5,50,50,75,25,30,0,0,0,0,64,64}}; void CreateDynamicEnemy(enemy*p, int bestiary_num) { memcpy(p,&(Bestiary[bestiary_num]),ENEMY_SIZE);}
COPY /V /Y F:\ROLAT\Code F:\PrizmSDK\COPY /V /Y F:\ROLAT\Code\Flibs F:\PrizmSDK\COPY /V /Y F:\ROLAT\Code\Data F:\PrizmSDK\COPY /V /Y F:\ROLAT\Code\Headers F:\PrizmSDK\includeCOPY /V /Y F:\ROLAT\Graphics\Icons F:\PrizmSDK\iconsCD "F:\PrizmSDK"DEL ROLAT.binDEL Main.binbin\make.exe %*@ECHO offIF NOT EXIST F:\PrizmSDK\ROLAT.g3a GOTO ENDMOVE /Y F:\PrizmSDK\ROLAT.g3a F:\ROLAT\Builds\PlaceH.placehCD F:\ROLAT\Builds\ECHO PlaceHold > ROLAT.g3aCOPY /Y PlaceH.placeh ROLAT.g3aSET FileDate=%date:/=%_%time::=%REN ROLAT.g3a "ROLAT_%FileDate%.g3a"ECHO Build Version ROLAT_%FileDate%:ENDPAUSE@ECHO on
System ERROR REBOOT :[EXIT] INITIALIZE:[EXE] ADDRESS(W) TARGET=55555567 PC =0810000A