Pages: 1
Posted on 06-27-16, 11:14 pm
Mariomaster

Karma: 8166
Posts: 578/1609
Since: 06-09-12

I made a small hack some time ago, which allows you to have stompable big boxes.

Here the code:

#include "nsmb.h" void changeTileAny(void* ptr, int x, int y, int t) { //changeTile uses values from a table instead of actual map16 tile numbers. //With this hack we can set any tile numbers. //T is a Map16 tile number. setTileTable[0] = t; changeTile(ptr, x, y, 0); setTileTable[0] = 0; } void hook_020FD1D4(MarioActor *athis) { // Check if Player is Groundpounding if ((athis->groundPoundRelated77E & 0x2) != 0) { u32 xPos = (athis->xPos>>12) / 16; u32 yPos = ((-athis->yPos)>>12) / 16; int tb = getTileBehaviorAtPos2(xPos*16, yPos*16); int tbN = (tb & 0xF0) >> 4; // Checks if Power-Up state isn't Mini or small Mario if (tbN == 0xE && (athis->marioPowerupState == 0 || athis->marioPowerupState == 4)) return; if (tbN == 0xF || tbN == 0xE) { // Groundpounded on Block with correct behavior u32 sx = xPos; u32 dx = xPos; u32 sy = yPos; u32 dy = yPos; // Get width and height of block for (int i=-1;; i--) { int ctbN = (getTileBehaviorAtPos2((xPos+i)*16, yPos*16) & 0xF0) >> 4; if (ctbN == 0xF || ctbN == 0xE) sx--; else break; } for (int i=1;; i++) { int ctbN = (getTileBehaviorAtPos2((xPos+i)*16, yPos*16) & 0xF0) >> 4; if (ctbN == 0xF || ctbN == 0xE) dx++; else break; } for (int i=1;; i++) { int ctbN = (getTileBehaviorAtPos2(xPos*16, (yPos+i)*16) & 0xF0) >> 4; if (ctbN == 0xF || ctbN == 0xE) dy++; else break; } // Destroy the block for (int x=sx; x<=dx; x++) { for (int y=sy; y<=dy; y++) changeTileAny(ptrToLevelActor, x*16, y*16, 0); } } } }



Add this to symbols.x:

ptrToLevelActor = 0x020CAD40; changeTile = 0x020AF30C; setTileTable = 0x020C7EAC;


Replace the MarioActor struct in nsmb.h with this one:



The new tilebehaviors, which are now available are:

FY XX XX XX: Stompable box, even stompable with mini or small Mario
EY XX XX XX: Stompable box, not stompable with mini or small Mario

XX can be anything. So you can even make it icy or smth. For working correctly, the blocks should be at least solid on top.
Y will be the particle ID that will be spawned when I update the hack (thanks to  skawo for already telling me the particle spawner function)

Also not all blocks in one "box" have to share the same behavior. The only thing, that matters is, that the first nybble is 0xE or 0xF.


I used some code from  Dirbaio's Tile hack and some parts of the CR code.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 06-28-16, 03:53 am



Karma: 477
Posts: 85/139
Since: 04-08-16
That would be useful to know the use of it

Also, the result with bigger boxes is awful in my opinion, however, its great with smaller ones

Good job anyway
The Legendary Sprite 326:
Posted on 06-28-16, 04:36 am (rev. 1 by  newluigidev on 06-28-16, 04:36 am)
Buzzy Beetle


Karma: 2007
Posts: 128/398
Since: 08-17-15
Could you have items in these? For example, like an Airship crate in NSMBW?
_________________________
tre3 z0N3

Posted on 06-28-16, 06:18 am
Birdo


Karma: 2669
Posts: 1635/2081
Since: 06-26-11
It is possible. See ? Blocks and Brick Blocks
Posted on 06-28-16, 07:12 am
Buzzy Beetle


Karma: 2007
Posts: 129/398
Since: 08-17-15
Posted by Hiccup
It is possible. See ? Blocks and Brick Blocks

Cool! Thanks for letting me know.
_________________________
tre3 z0N3

Posted on 06-28-16, 12:06 pm
Birdo


Karma: 2669
Posts: 1636/2081
Since: 06-26-11
And basically anything is possible with ASM, unless it requires hardware capabilities that the DS doesn't have.
Posted on 06-28-16, 04:18 pm
Panser


Karma: 763
Posts: 83/331
Since: 11-20-15
Which graphics do they use? Jyotyu? Tileset?
_________________________
Posted on 06-28-16, 06:25 pm
Mariomaster

Karma: 8166
Posts: 579/1609
Since: 06-09-12
You can use any tile of any tileset. Doesn't matter if Jyotyu, Normal or Sub Nohara.

Only the tilebehaviors are important. If you are interestet, look at the code, how it works. It isn't that complicated
_________________________
GitHub - Kuribo64 - YouTube
Posted on 07-22-16, 01:56 am (rev. 4 by ImageBot on 11-21-16, 03:21 am)


Karma: 1064
Posts: 83/200
Since: 02-02-15
Stompable Big Blocks - Newbie Way:

There is a friendly mode for newbies if the user don't know C++.
It's not exactly the same thing, but the result is very interesting.
At the end of this post you can download a level example.

You will need:
- Sprite 168 (IF event),
- Sprite 197 (Create/Destroy),
- Zone,
- Mushroom,
- Sprite 192 (Coins) (... it's optional).

The example below show a simple bonus room, with two line of bricks.
When player perform a Ground-Pound, all bricks will blow-up.


A simple bonus room with a Stompable BigBlocks like-effect.

Let's Make:

1. Putting Bricks:
- Insert a line of bricks the size you want.
- This example use 5x5.

2. Putting a Zone:
- Insert a zone over the bricks.
- The Zone must be half tile small in height of the bricks.
- For example, if you have 5 bricks height, the Zone will have 4.5 height.

3. Putting Sprite 197:
- Insert a Sprite 197 (Create/Destroy) over the bricks
- Input any ID to this sprite.

4. Putting Sprite 168:
- Insert a Sprite 168 (IF event) near the bricks.
- Target ID = Sprite 197 "Input ID".
- Enemy Zone ID = 255.

5. Putting Sprite 192 (optional):
- If you want a special effect, put some Sprites 192 on top of the bricks.
- Input ID = Sprite 197 "Input ID".

6. Copying bricks (optional):
- If you want more, just Ctrl-Drag all selection and incremment the zone and Sprite IDs.

Here is a video demonstrating the result. Sorry the quality (hardware limitations).




Download example level:
NSMB_Newbie_Stompable_BigBlocks_Effect_1500.nml

[] -P
Posted on 07-22-16, 06:20 am
Birdo


Karma: 2669
Posts: 1667/2081
Since: 06-26-11
That's a pretty neat trick, pinet. Thanks for sharing
Posted on 07-23-16, 03:29 pm (rev. 1 by  pinet on 07-23-16, 03:29 pm)


Karma: 1064
Posts: 87/200
Since: 02-02-15
You are wellcome.
It is a pleasure to add some tips for users like me, who do not have much programming knowledge.

[] -P
Pages: 1