ID:1714568
 
Problem description:
Before I get into things, I am currently coding for a game that's been around for ages, so I'm working with very old code. Likewise, I am probably less experienced at programming than a novice, so please bare with me. I am, more or less, an oldbie who was given permission to edit the source and host said game.

Now onto the issue we're having. For years, this game has had sprite overlapping issues, and now that I'm at the helm, I want to try and get to the bottom of it. The game uses .pngs for enemy mobs (this is a turn-based RPG for the record.) Smaller sprites seem to overlap when larger sprites are being displayed on screen. I believe this is the code for enemy mob placement.

Code:
                var/totwidth = mmm.pixwidth
for (var/mob/NPC/enemys/m2 in mmm.group)
totwidth += m2.pixwidth
var/startwidth = totwidth/2
startwidth = round(startwidth/32-0.5)*-1
mmm.loc = locate(m.x+startwidth,m.y+2,m.z)

var/nextstartloc
var/nextoffsetpix
if (mmm.pixwidth<32)
nextstartloc = startwidth
nextoffsetpix = mmm.pixwidth
else if (mmm.pixwidth<64)
nextstartloc = startwidth+1
nextoffsetpix = mmm.pixwidth-32
else if (mmm.pixwidth<96)
nextstartloc = startwidth+2
nextoffsetpix = mmm.pixwidth-64
else if (mmm.pixwidth<128)
nextstartloc = startwidth+3
nextoffsetpix = mmm.pixwidth-96
else
nextstartloc = startwidth+4
nextoffsetpix = mmm.pixwidth-128
for (var/mob/NPC/enemys/m2 in mmm.group)
m2.loc = locate(m.x+nextstartloc,m.y+2,m.z)
m2.pixel_x = nextoffsetpix

if (m2.pixwidth<32)
nextoffsetpix = nextoffsetpix+m2.pixwidth
else if (m2.pixwidth<64)
nextoffsetpix = nextoffsetpix+m2.pixwidth-32
nextstartloc+=1
else if (m2.pixwidth<96)
nextoffsetpix = nextoffsetpix+m2.pixwidth-64
nextstartloc+=2
else if (m2.pixwidth<128)
nextoffsetpix = nextoffsetpix+m2.pixwidth-96
nextstartloc+=3
else
nextoffsetpix = nextoffsetpix+m2.pixwidth-128
nextstartloc+=4


while (nextoffsetpix>32)
nextoffsetpix -= 32
nextstartloc += 1


If anyone has any advice on what to change, it would very much be appreciated!
Without reading through that, I recall a bug that occurred awhile back that I'm unsure of the status on if it's been fixed or not; but the map_format was the cause. Try changing that.
map_format = TOPDOWN_MAP

The older sources use the tiled map format, which is what caused the bug for me.

If it doesn't work, feel free to comment back, I'll try to help out where I can.
When I change it from tiled icon map to topdown map, the game begins displaying monsters like this: http://i.imgur.com/lW5yH6y.png (Yes this is a fangame.) Whereas if I had encountered this monster alone, it would have been fine. If it would have been coupled with a larger mob, that cyclops would have been displayed higher on the y axis.
This is probably on account of the sprite's state being drawn to the screen multiple times. If the sprite was broken up into tiles beforehand, each sprite tile serves as its own overlay or atom. However, now that it's just one big icon, the system needs to be changed so that only one sprite is drawn and not length*width tiles (which seems to be 4*4 tiles in this case).
Breaking the sprites into 32x32 tiles, right? I believe a GM on staff does that for their games. Otherwise, I'm not entirely sure how to change the current system, although I am willing to learn if I'm pointed in the right direction.