Jump to content

Photo
- - - - -

Advanced Grass

FFC

  • Please log in to reply
2 replies to this topic

#1 Nick

Nick

    Dream Traveler

  • Site Staff
  • Real Name:Nick
  • Gender:Male
  • Location:Kentucky

Posted 23 January 2012 - 04:47 PM

Advanced Grass
By dragonsword

Description

This script allows you to use relational Tall Grass combos such as those in Gonken's DoR Pack Screenshot 6. (where I got the tiles for the demo)

Screenshots and Demo

Posted Image

Script Demo Quest: Download Here

Code

The script: (remember to import std.zh)

// AdvGrass.z
// A script that correctly displays tall grass combos relationally
// (Searches layer 0 for tall grass combos, and draws new combos over them
// Good for grass combos that have a "border" of sorts around them)
// By Raiu
//
// Arrange tiles like this:
// Lone, DownVertEnd, UpVertEnd, Vertical, RightHorzEnd, DownRight, UpRight, Right, LeftHorzEnd, DownLeft, UpLeft, Left, Horizonal, Down, Up, Middle
// (this script does not support inside corner graphics...)
//
// D0 = Combo Type
//		Tallgrass = 57
//		Tallgrass continuous = 136
//		Tallgrass -> next = 141
// D1 = First Tile of the above
// D2 = Cset to use
// D3 = Layer to Draw on

ffc script AdvGrass{
	void run(int inType, int inTile, int inCset, int inLayer){
		Waitframe();
		int adj=0;
		while(true){
			for(int x = 0; x<16; x++){
				for(int y = 0; y<11; y++){
					if(Screen->ComboT[CIndex(x,y)]==inType){
						if(Screen->ComboT[CIndex(x,y-1)]==inType) adj+=1;
						if(Screen->ComboT[CIndex(x,y+1)]==inType) adj+=2;
						if(Screen->ComboT[CIndex(x-1,y)]==inType) adj+=4;
						if(Screen->ComboT[CIndex(x+1,y)]==inType) adj+=8;
						if(adj!=15){
							Screen->DrawTile(inLayer, x*16, y*16, inTile+adj, 1, 1, inCset, -1,-1, 0, 0, 0, 0, 1, 128);
						}
					adj=0;
					}
				}	
			}
			Waitframe();
		}
	}
	int CIndex(int x, int y){
		if(x<0||x>15||y<0||y>10) return -1;
		return y*16 + x;
	}
}

// This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.


Setup

D0 = Combo Type to check for (57=tallgrass, 141=tallgrass->next, and 136=tallgrass continuous)
D1 = First Tile *see below
D2 = Cset
D3 = Layer to draw on

*How to lay out your tiles:
Posted Image
(Lone, DownVertEnd, UpVertEnd, Vertical, RightHorzEnd, DownRight, UpRight, Right, LeftHorzEnd, DownLeft, UpLeft, Left, Horizonal, Down, Up, Middle)

Resources

HEADER: std.zh (included with ZC)

#2 lucas92

lucas92

    Defender

  • Members
  • Gender:Unspecified

Posted 25 February 2012 - 01:06 PM

I like it, but there seems something to fix when the grass is on the border of the screen. In the bottom screen, the grass on top of the screen should display full tile, but the top of the tile seems eaten...

#3 Zim

Zim

    Junior

  • Members
  • Real Name:Zim
  • Gender:Male
  • Location:Washington

Posted 16 June 2013 - 01:13 PM

I would also point out that the CIndex, athough is ingenuitive, isn't necessarry.

ffc script AdvGrass{
    void run(int inType, int inTile, int inCset, int inLayer){
        Waitframe();
        int adj=0;
        while(true){
            for(int x = 0; x<=240; x+=16){
                for(int y = 0; y<=160; y+=16){
                    if(Screen->ComboT[ComboAt(x,y)]==inType){
                        if(Screen->ComboT[ComboAt(x,y-16)]==inType) adj+=1;
                        if(Screen->ComboT[ComboAt(x,y+16)]==inType) adj+=2;
                        if(Screen->ComboT[ComboAt(x-16,y)]==inType) adj+=4;
                        if(Screen->ComboT[ComboAt(x+16,y)]==inType) adj+=8;
                        if(adj!=15){
                            Screen->DrawTile(inLayer, x*16, y*16, inTile+adj, 1, 1, inCset, -1,-1, 0, 0, 0, 0, 1, 128);
                        }
                    adj=0;
                    }
                }    
            }
            Waitframe();
        }
    }

Would do the exact same thing and put the engine through less functions.





Also tagged with one or more of these keywords: FFC

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users