Menu

Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.

Voir les contributions Menu

Sujets - faeldaniel

#1
I am put all graphics in VRAM with DMA Copy, the size of address of Sprites I am just using:
void oamInitGfxAttr(0x0000, OBJ_SIZE8);

Because i can only use  Sprites from address 0x0000 to 0x1FF0 (size 0x1FF0?) in gfxoffset? I need using between 0x0000 to 0x2FF0 for the Sprites, but the sprites is not operate from 0x2000, is one limit?
#2
Hi alekmaul,

Remember that bug with the function oamSetXYEx, if your set oamSetEx as OBJ_SMALL and value of X in oamSetXYEx as value negative the sprite is changed for OBJ_LARGE while this sprite is negative I quoted here http://www.portabledev.com/smf/index.php?topic=324.0

you can find any solution?
#3
Hello alekmaul,

I am created my Routine for get Map Collision, I need to know what is the value a certain tile, for exemple, i having one Map Collision with Width 256 and Heigth 512 and genarate my Collision Map, your name is definide as &mapcol for this imagem, i liked get value of 14º tile and return if is 1st or 2st tile becouse Map Collision has only 2 tiles.

Citation
shot valueOfTile;

valueOfTile = &mapcol / (13); //13st tile, return 1 or 1st Tile
valueOfTile = &mapcol / (14); //14st tile, Return 1 or 1st Tile
valueOfTile = &mapcol / (15); //15st tile, Return 2 or 2st Tile
valueOfTile = &mapcol / (16); //16st tile, Return 2 or 2st Tile
valueOfTile = &mapcol / (17); //17st tile, Return 1 or 1st Tile
valueOfTile = &mapcol / (18); //18st tile, Return 2 or 2st Tile

...

#4
Hello alekmaul,

I have this problem in my initial studies and whait becouse this is not important in moment, i soluvied all problems for my game but the only one persister, this Background Priority, i need with the background layer in mode 1:

"Front" < BG3, BG2, SPRITES, BG1 > "Behind"

I control individual layers perfectly in VRAM, i developed my implementation for show dialog for texts in BG3 its it work very good because I have had problem with native consoleDrawText() in BG3.

My view structure is thus:

<Front Screen>
BG3 -> Here Dialog texts (I need set bit priority for 1, default is 0)
BG2 -> Here will be for example, leaf of trees, to create depth effect for the sprite (I need set bit priority for 1, default is 0)
OBJ -> Are all sprites (The priority i set in 2 and working becouse is native in function OamSet)
BG1 -> Here all background for my map (the bit priority default is 0, so no need to do anything)
<Behind>


From what I read this is possible becouse i see in the official documentation as provided by Nintendo in the page 214, this point talk about this http://99.10.161.154/alcaro/docs/book1_text.pdf simply to set priorities so:
BG3 -> priority 1
BG2 -> priority 1
OBJ -> priority 2
BG1 -> priority 0


I see too in No$sns in Vram Viewer in tabs individual BGs i see filder "Priority".

Talking with KungFuFurby he also commented that:
CitationThis is how you get that type of arrangement (if I interpreted http://nocash.emubase.de/fullsnes.htm#snespictureprocessingunitppu 's background priority chart correctly)

I need set this priority flag, this should be done with graphics (gfx2snes) converter correct?
#5
Hello alekmaul,

i did not understand how the collision in unique existing example in "likemario"  :-\

As I understand it you must create an image with two color palettes where the first color is pink, the second color is the collision. Having as an example of "AnimatedSprite" how do I image that the sprite does not move through the squares reds? below is how I did it so does not work.

This is my example "AnimatedSprite" but not work, this is link for the project test the collision https://anonfiles.com/file/d156b7840b851b865b018ff44df47b41:



/*---------------------------------------------------------------------------------
Animated Sprite demo
-- alekmaul
Sprite from Stephen "Redshrike" Challener), http://opengameart.org
---------------------------------------------------------------------------------*/
#include <snes.h>

extern char gfxpsrite, gfxpsrite_end;
extern char palsprite, palsprite_end;

extern char patterns, patterns_end;
extern char palette, palette_end;
extern char map, map_end;

extern char col, col_e;

#define FRAMES_PER_ANIMATION 3 // 3 sprites per direction

//---------------------------------------------------------------------
// The Monster sprite
//---------------------------------------------------------------------
typedef struct
{
short x, y;
int gfx_frame;
int state;
int anim_frame;
int flipx;
} Monster;

//---------------------------------------------------------------------
// The state of the sprite (which way it is walking)
//---------------------------------------------------------------------
enum SpriteState {W_DOWN = 0, W_UP = 1, W_RIGHT = 2,  W_LEFT = 2};

//---------------------------------------------------------------------
// Screen dimentions
//---------------------------------------------------------------------
enum {SCREEN_TOP = 0, SCREEN_BOTTOM = 224, SCREEN_LEFT = 0, SCREEN_RIGHT = 256};

char sprTiles[9]={0,2,4, 6,8,10, 12,14,32};  // Remeber that sprites are interleave with 128 pix width,


//---------------------------------------------------------------------
// The magic function for collision
//---------------------------------------------------------------------
u16 getCollisionTile(u16 x, u16 y) {
u16 *ptrMap = (u16 *) &col + (y) + (x);

return (*ptrMap);
}

//---------------------------------------------------------------------------------
int main(void) {
unsigned short pad0,i;
Monster monster = {10,10};

    // Initialize SNES
consoleInit();

// Init Sprites gfx and palette with default size of 16x16
oamInitGfxSet(&gfxpsrite, (&gfxpsrite_end-&gfxpsrite), &palsprite, (&palsprite_end-&palsprite), 0, 0x0000, OBJ_SIZE16);


// Copy tiles to VRAM
bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);

// Copy Map to VRAM
bgInitMapSet(0, &map, (&map_end - &map),SC_32x32, 0x1000);


// Define sprites parameters
oamSet(0,  monster.x, monster.y, 0, 0, 0, 0, 0);
oamSetEx(0, OBJ_SMALL, OBJ_SHOW);


// Now Put in 16 color mode and disable all backgrounds
setMode(BG_MODE1,0); bgSetDisable(1); bgSetDisable(2);

// Wait VBL 'and update sprites too ;-)
WaitForVBlank();

// Wait for nothing :P
while(1) {
// Refresh pad values
scanPads();

// Get current #0 pad
pad0 = padsCurrent(0);

if (pad0) {
// Update sprite with current pad
if(pad0 & KEY_UP) {
if (getCollisionTile((monster.x), ((monster.y) - 1)) == 0) {
if(monster.y >= SCREEN_TOP) monster.y--;
}
monster.state = W_UP;
monster.flipx = 0;
}
if(pad0 & KEY_LEFT) {
if (getCollisionTile(((monster.x) - 1), (monster.y)) == 0) {
if(monster.x >= SCREEN_LEFT) monster.x--;
}
monster.state = W_LEFT;
monster.flipx = 1;
}
if(pad0 & KEY_RIGHT) {
if (getCollisionTile(((monster.x) + 1), (monster.y)) == 0) {
if(monster.x <= SCREEN_RIGHT) monster.x++;
}
monster.state = W_LEFT;
monster.flipx = 0;
}
if(pad0 & KEY_DOWN) {
if (getCollisionTile((monster.x), ((monster.y) + 1)) == 0) {
if(monster.y <= SCREEN_BOTTOM) monster.y++;
}
monster.state = W_DOWN;
monster.flipx = 0;
}
monster.anim_frame++;
if(monster.anim_frame >= FRAMES_PER_ANIMATION){
monster.anim_frame = 0;
}
}

// Now, get current sprite in current animation
monster.gfx_frame = sprTiles[monster.anim_frame + monster.state*FRAMES_PER_ANIMATION ];
oamSet(0,  monster.x, monster.y, 3, monster.flipx, 0, monster.gfx_frame, 0);


// Wait VBL 'and update sprites too ;-) )
WaitForVBlank();
}
return 0;
}




Fix this code for me?  ;D
#6
Hello Alekmaul,

When we have a new version?  :D

look this, when i am set in coordinates with 0 the sprite disappears :
oamMemory[id + 0] = 0;

if set in coordinates (-50) for example the sprite go to position (200) .
oamMemory[id + 0] = -50;

I would like the coordinates of the sprite corresponds to the size of the background and not 0 to 255, this is possible?
#7
Watch this video:
http://www.youtube.com/watch?v=kSPknysJaVY

One of the my tests with sprites and background, it was perfect  ;), would like to put an the spriter BG0 between BG1 and in this example it stayed behind the BG0 and BG1, this is part of my code:


// Copy tiles to VRAM
bgInitTileSet(1, &patterns_bg, &palette_bg, 3, (&patterns_end_bg - &patterns_bg), (&palette_end_bg - &palette_bg), BG_16COLORS, 0x6000);
bgInitTileSet(0, &patterns_fence, &palette_fence, 4, (&patterns_end_fence - &patterns_fence), (&palette_end_fence - &palette_fence), BG_16COLORS, 0x5000);

// Copy Map to VRAM
bgInitMapSet(1, &map_bg, (&map_end_bg - &map_bg),SC_32x32, 0x4800);
bgInitMapSet(0, &map_fence, (&map_end_fence - &map_fence),SC_32x32, 0x4000);

//My Char Kyle Blackthorne
oamInitGfxSet(&gfxpsrite_kyle_1, (&gfxpsrite_end_kyle_1 - &gfxpsrite_kyle_1), &palsprite_kyle_1, 0, 0x0000, OBJ_SIZE32);
oamSet(0,  mycharKyle.x, mycharKyle.y, 0, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0);
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);

setMode(BG_MODE1, 0);  bgSetDisable(2);


With this code he stands in front of all background

oamSet(0,  mycharKyle.x, mycharKyle.y, 3, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0);

I would like to stay sprite between background.  ;D
#8
Hello guys,

First, how to work with strings in lib, this is possible?

Second, how do I join two variables of type chars?
Exemple:

char out1  [] = "PVSnes";
char out2  [] = "Lib";

//In java this is possible, but not in C :-(
char out3 []  = out1  + out2 ;

consoleDrawText(1,1, "This is union: %s", out3);


With pointers

char *out1  = "PVSnes";
char *out2  = "Lib";

//This is not possible :-(
char *out3 = out1  + out2 ;

consoleDrawText(1,1, "This is union: %s", out3);


With the console I can do it, but I want to do directly with a variable, exemple:
consoleDrawText(1,13,"Union in console: %s %s", "fael", "daniel");
#9
English:
Hello everybody, I am Brazilian, as programmer I want to thank for the development of this lib, considered the native language of the SNES very complex, currently I schedule in java that is very similar to C, since I took my first steps in developing thanks to great wiki and documentation, such as routine texts for RPGs, backgrounds, sprites, actions clicks the control etcs. I hope the lib is constantly updated, I want to help when you're at a good level in language, again thank you.

Portugu?s:
Olá pessoal, sou  brasileiro, como programador quero agradecer pelo desenvolvimento dessa lib, considerava a linguagem nativa do SNES muita complexa, atualmente programo em java que é muito semelhante ao C, já dei meus primeiros passos no desenvolvimento graças a ótima wiki e sua documentaç?o, como por exemplo, rotina de textos para RPGS, fundos, sprites, aç?es nos cliques do controle etcs. Espero que a lib seja constantemente atualizada, quero até poder contribuir quando estiver num nível bom na linguagem, novamente muito obrigado.