View Single Post
Old 17 January 2015, 03:29   #18
Nekoniaow
Banned
 
Join Date: Dec 2014
Location: Montreal
Posts: 129
Quote:
Originally Posted by Arne View Post
My icons are variable width, so using some kind of general mask (if I understand you correctly) might not work for say, 42 pixels wide images then? I'll look in the manual. If not there chance are that I can get to it low level anyways.
Actually that would work too. The blitter has two such masks: one for the first 16 pixels and one for the last 16 of each line.

Quote:
Originally Posted by Arne
Letting unmasked tiles overlap when drawn would work if I update the entire map in read order and didn't have to care about the righthand GUI, but I mostly update select tiles.
Makes sense.

Quote:
Originally Posted by Arne
Anyways, over a thousand lines of Gosubs is beginning to get very unwieldly!

Situation 1: I may have a For-Loop with X that I assume is temporary because my X'es are always temporary, but I call a Gosub which calls a Gosub which modifies X for some other purpose. Ouch! Solution: Be more agressive with unique variables?
I'm crying tears of blood just thinking of you right now.
Very seriously there's only one valid solution out of this hell: use named procedures. They might be unwieldy in Amos but this is nothing compared to the brain cells you are sending to hell through the use of gosub.

The control flow of your code must be clear otherwise you will waste time figuring out what you are doing instead of actually doing it.

Quote:
Originally Posted by Arne
Situation 2: I have a register/argument/parameter value of some sort, like YSelect, intended to be accessible, but forget myself and modify it when doing some temporary thing because it came in as an argument. Solution: Chuck such variables into unique variables at the top of the Gosub, even when I think it'll be fine anyways.

I WILL make this thing all Gosub. Here's a battle to be won!
Actually, it's a *VERY* good practice to avoid modifying variables as much as possible. If you think you need to use and modify a variable which has other uses, just create a new one. But in general, aside from loop indices and results of computations most variables should be compute-once-read-many.

Ex:
Code:
Let YSelect = <value from the argument>
<some code here>
Let YSelectForPurposeABC = YSelect + some formula
<then you can use both variables here without confusion>
This will help make your code much more readable.
And readability is the most important quality of any code, especially in the early stages.
Nekoniaow is offline  
 
Page generated in 0.05077 seconds with 11 queries