I'm keen to update some of the templates, there's a lot of the codebase which isn't well designed from a graphics point of view, eg. the river bank sprite sheets. My development version uses:

Code: Select all

```
template template_waterfeature_slopes(x, y, z) {
//Flat
//Straight sides
[ 27*z+x*z, 41*z+y*z, 38*z, 19*z-1, -5*z, 0*z ]
[ 27*z+x*z, 14*z+y*z, 38*z, 19*z-1, -5*z, 13*z ]
[ 1*z+x*z, 54*z+y*z, 38*z, 19*z-1, -31*z, 13*z ]
[ 1*z+x*z, 1*z+y*z, 38*z, 19*z-1, -31*z, 0*z ]
//Outer corners
[ 41*z+x*z, 91*z+y*z, 24*z, 12*z-1, 9*z, 10*z ]
[ 21*z+x*z, 101*z+y*z, 24*z, 12*z-1, -11*z, 20*z ]
[ 1*z+x*z, 91*z+y*z, 24*z, 12*z-1, -31*z, 10*z ]
[ 21*z+x*z, 81*z+y*z, 24*z, 12*z-1, -11*z, 0*z ]
//Inner corners
[ 49*z+x*z, 133*z+y*z, 16*z, 8*z-1, 17*z, 12*z ]
[ 25*z+x*z, 145*z+y*z, 16*z, 8*z-1, -7*z, 24*z ]
[ 1*z+x*z, 133*z+y*z, 16*z, 8*z-1, -31*z, 12*z ]
[ 25*z+x*z, 121*z+y*z, 16*z, 8*z-1, -7*z, 0*z ]
//NW down
//Straight sides
[ 223*z+x*z, 41*z+y*z, 37*z, 18*z-1, -4*z, 0*z ]
[ 223*z+x*z, 7*z+y*z, 37*z, 18*z-1, -4*z, 6*z ]
[ 196*z+x*z, 47*z+y*z, 37*z, 18*z-1, -31*z, 6*z ]
[ 196*z+x*z, 1*z+y*z, 37*z, 18*z-1, -31*z, 0*z ]
//Outer corners
[ 236*z+x*z, 86*z+y*z, 24*z, 9*z-1, 9*z, 5*z ]
[ 216*z+x*z, 96*z+y*z, 24*z, 9*z-1, -11*z, 16*z ]
[ 196*z+x*z, 91*z+y*z, 24*z, 9*z-1, -31*z, 10*z ]
[ 216*z+x*z, 81*z+y*z, 24*z, 9*z-1, -11*z, 0*z ]
//Inner corners
[ 244*z+x*z, 127*z+y*z, 16*z, 6*z-1, 17*z, 6*z ]
[ 220*z+x*z, 139*z+y*z, 16*z, 6*z-1, -7*z, 18*z ]
[ 196*z+x*z, 133*z+y*z, 16*z, 6*z-1, -31*z, 12*z ]
[ 220*z+x*z, 121*z+y*z, 16*z, 6*z-1, -7*z, 0*z ]
//SW down
//Straight sides
[ 92*z+x*z, 41*z+y*z, 38*z, 27*z-1, -5*z, -8*z ]
[ 92*z+x*z, 14*z+y*z, 38*z, 27*z-1, -5*z, 5*z ]
[ 66*z+x*z, 54*z+y*z, 38*z, 27*z-1, -31*z, 5*z ]
[ 66*z+x*z, 1*z+y*z, 38*z, 27*z-1, -31*z, -8*z ]
//Outer corners
[ 106*z+x*z, 91*z+y*z, 24*z, 15*z-1, 9*z, 2*z ]
[ 86*z+x*z, 106*z+y*z, 24*z, 15*z-1, -11*z, 17*z ]
[ 66*z+x*z, 96*z+y*z, 24*z, 15*z-1, -31*z, 7*z ]
[ 86*z+x*z, 81*z+y*z, 24*z, 15*z-1, -11*z, -8*z ]
//Inner corners
[ 114*z+x*z, 133*z+y*z, 16*z, 10*z-1, 17*z, 4*z ]
[ 90*z+x*z, 151*z+y*z, 16*z, 10*z-1, -7*z, 22*z ]
[ 66*z+x*z, 139*z+y*z, 16*z, 10*z-1, -31*z, 10*z ]
[ 90*z+x*z, 121*z+y*z, 16*z, 10*z-1, -7*z, -8*z ]
//NE down
//Straight sides
[ 158*z+x*z, 41*z+y*z, 37*z, 18*z-1, -4*z, 0*z ]
[ 158*z+x*z, 7*z+y*z, 37*z, 18*z-1, -4*z, 6*z ]
[ 131*z+x*z, 47*z+y*z, 37*z, 18*z-1, -31*z, 6*z ]
[ 131*z+x*z, 1*z+y*z, 37*z, 18*z-1, -31*z, 0*z ]
//Outer corners
[ 171*z+x*z, 91*z+y*z, 24*z, 9*z-1, 9*z, 10*z ]
[ 151*z+x*z, 96*z+y*z, 24*z, 9*z-1, -11*z, 16*z ]
[ 131*z+x*z, 86*z+y*z, 24*z, 9*z-1, -31*z, 5*z ]
[ 151*z+x*z, 81*z+y*z, 24*z, 9*z-1, -11*z, 0*z ]
//Inner corners
[ 179*z+x*z, 133*z+y*z, 16*z, 6*z-1, 17*z, 12*z ]
[ 155*z+x*z, 139*z+y*z, 16*z, 6*z-1, -7*z, 18*z ]
[ 131*z+x*z, 127*z+y*z, 16*z, 6*z-1, -31*z, 6*z ]
[ 155*z+x*z, 121*z+y*z, 16*z, 6*z-1, -7*z, 0*z ]
//SE down
//Straight sides
[ 287*z+x*z, 41*z+y*z, 38*z, 27*z-1, -5*z, -8*z ]
[ 287*z+x*z, 14*z+y*z, 38*z, 27*z-1, -5*z, 5*z ]
[ 261*z+x*z, 54*z+y*z, 38*z, 27*z-1, -31*z, 5*z ]
[ 261*z+x*z, 1*z+y*z, 38*z, 27*z-1, -31*z, -8*z ]
//Outer corners
[ 301*z+x*z, 96*z+y*z, 24*z, 15*z-1, 9*z, 7*z ]
[ 281*z+x*z, 106*z+y*z, 24*z, 15*z-1, -11*z, 17*z ]
[ 261*z+x*z, 91*z+y*z, 24*z, 15*z-1, -31*z, 2*z ]
[ 281*z+x*z, 81*z+y*z, 24*z, 15*z-1, -11*z, -8*z ]
//Inner corners
[ 309*z+x*z, 139*z+y*z, 16*z, 10*z-1, 17*z, 10*z ]
[ 285*z+x*z, 151*z+y*z, 16*z, 10*z-1, -7*z, 22*z ]
[ 261*z+x*z, 133*z+y*z, 16*z, 10*z-1, -31*z, 4*z ]
[ 285*z+x*z, 121*z+y*z, 16*z, 10*z-1, -7*z, -8*z ]
}
```

IMO this is more logical, and is much easier for drawing the actual sprites. I'm also keen to allow for multiple zoom levels simply.

Here, the image is 467 x 48 pixels. The rightmost sprite is the flat tile sprite, at (322*z+x*z, 1*z+y*z). With a x = 80, y = 0 and z (zoom) = 1, this gives coordinates (322*1+80*1, 1*1+0*1) = (402, 1) which is in bounds. The sprite size is 64*1 x 32*1-1 = 64 x 31, therefore the right-bottommost pixel is (466, 32) which is also in bounds.

Not that I know which of the sprites causes the issues, and NML doesn't report which sprite or which coordinate is out of bounds... All-in-all I'm confused, which is why I think I must be missing something obvious. Unless Quast65 is right about equation evaluation not following BODMAS?