Author Topic: filling subroutine  (Read 7846 times)

0 Members and 1 Guest are viewing this topic.

SirCmpwn

  • Guest
Re: filling subroutine
« Reply #15 on: November 11, 2010, 06:52:35 pm »
Well, what you just said happens to be true.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: filling subroutine
« Reply #16 on: November 11, 2010, 06:54:19 pm »
Well for instance if you try to fill the entire screen from the top left hand corner, the algorithm will travel back and forth, down the entire screen until it gets to the bottom, at which point every single point on the screen will be in the stack.  Even though the screen is very simple, it poses the least efficient stack usage.

SirCmpwn

  • Guest
Re: filling subroutine
« Reply #17 on: November 11, 2010, 06:55:07 pm »
Yeah.  There are better ways, which I will help you with later, kindermonumonte.

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: filling subroutine
« Reply #18 on: November 11, 2010, 06:57:03 pm »
OK, thank.
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: filling subroutine
« Reply #19 on: December 08, 2010, 01:49:12 pm »
Up.
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: filling subroutine
« Reply #20 on: December 09, 2010, 07:42:03 am »
I'm sure he is busy with KOS and such. The only algorithm I know is that recursive fill program that he used. To prevent that wonderful stack overflow, what you could do is essentially find the points that haven't been filled in, and go back and do the algorithm on those.  The only problem is how you would find which places still need to be filled in. I guess you could go through the stack, and delete (set to FF or something) the points that have pixels in the 4 directions (left, right, up, and down) and have their pixel filled in.  Then "collapse" the stack by going through and basically skipping over any FF data and moving the other points down.  So, if Data A is at location 1, B at location 2, and C at location 3. B is deleted, so when "collapsing", go through and copy C into B, and turn C into FF.

Basically, this clears the stack up. If it's really complicated, then not many of your points are going to get cleared, and it's going to loop forever because it can't delete anything on the stack, nor can it draw any more points. The main problem with this algorithm, though, are two-fold.

1) I haven't tested it completely. I made something like it, but I'm not sure if it was that part of the algorithm that worked.
2) Considering you are doing sub( a lot, you basically have to delete both the point and pointer off of the stack. It's quite complicated.

Not sure what else to do, though.

SirCmpwn

  • Guest
Re: filling subroutine
« Reply #21 on: December 09, 2010, 06:48:49 pm »
I'm quite busy at the moment, sorry I can't help you much.  I started working on a less stack-intensive routine, but it requires a lot of RAM, and it's really slow.  It's also really complicated and hard to write.
« Last Edit: December 09, 2010, 06:48:56 pm by SirCmpwn »