Register To Post



 Bottom   Previous Topic   Next Topic

#81
Re: Insect Combat
Posted on: 2011/12/25 1:13
VUE(xpert)
Joined 2003/9/3
Sweden
393 Posts
PVBCC EntryHighscore Top10CoderHOTY09 2ndLong Time User (9 Years) PVBCC 2010 1st20+ Game Ratings
I'm sure there's a way to solve it, but I don't quite follow what the problem is
Can you explain it further?
Top

#82
Re: Insect Combat
Posted on: 2011/12/25 2:35
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
OK, suppose I have this:

copymem
((void*)CharSeg2, (void*)GIANTCRAWL1CHAR512*16);
copymem((void*)BGMap(2), (void*)GIANTCRAWL1MAP512*16);

I was just wondering if there was a way to change the CharSeg and BGMap to, let's say, 1 and still make it show right without needing to put the exact same picture in VIDE and changing it to 1 that way?
Top

#83
Re: Insect Combat
Posted on: 2011/12/25 19:17
VUE(xpert)
Joined 2003/9/3
Sweden
393 Posts
PVBCC EntryHighscore Top10CoderHOTY09 2ndLong Time User (9 Years) PVBCC 2010 1st20+ Game Ratings
Sure, then you could use a function like this to loop through the map and update every cell in it:


void ChangeCharsegOfBGMap
(BYTE bgmapBYTE chseg) { 
  
HWORD i
   
  for (
i=0i<4096i++) { 
    
HWORDcurrCell = &BGMM[bgmap*(0x1000) + i]; 
    *
currCell &= 0xF9FF;
    *
currCell |= (chseg << 9)
  } 
}


With your example, you would use it like this:


copymem
((void*)CharSeg1, (void*)GIANTCRAWL1CHAR512*16); 
copymem((void*)BGMap(1), (void*)GIANTCRAWL1MAP512*16);
ChangeCharsegOfBGMap(11);
Top

#84
Re: Insect Combat
Posted on: 2011/12/25 21:28
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
Quote:

DanB wrote:
With your example, you would use it like this:

copymem
((void*)CharSeg1, (void*)GIANTCRAWL1CHAR512*16); 
copymem((void*)BGMap(1), (void*)GIANTCRAWL1MAP512*16);
ChangeCharsegOfBGMap(11);

Thanks! Now I don't have to cut the number of fighters down to 6. But I do have a question, though: Would that above code I quoted, does ChangeCharsegOfBGMap change it to 2 then? So I could just use it once before the fighting screen comes up to double all the players essentially?
Top

#85
Re: Insect Combat
Posted on: 2011/12/25 21:45
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
I can't put it in my code without causing stupid errors, like saying something is undeclared when in fact it is, and stupid stuff like that. Is there a way to insert it without it acting like a stupid moron? I've attached my code.

Attach file:


c ic.c Size: 35.80 KB; Hits: 19
Top

#86
Re: Insect Combat
Posted on: 2011/12/26 18:34
VUE(xpert)
Joined 2003/9/3
Sweden
393 Posts
PVBCC EntryHighscore Top10CoderHOTY09 2ndLong Time User (9 Years) PVBCC 2010 1st20+ Game Ratings
I dunno, I can't compile your code without having access to all your .h files too.

I'm guessing it's the BYTE declaration you're having problems with? Then you could just change it to char instead in this case to get rid of it.

Also, you should never call the function like this: ChangeCharsegOfBGMap(-1, -1); the bgmap parameter needs to be in the range 0-13, and chseg should be 0-3 ONLY.

Quote:

But I do have a question, though: Would that above code I quoted, does ChangeCharsegOfBGMap change it to 2 then? So I could just use it once before the fighting screen comes up to double all the players essentially?


The charseg of a BGMap is reset to what you set it to in VIDE only when you do a copymem, so after your copymems you can change the charseg of a map any number of times with ChangeCharsegOfBGMap and it will stay that way. I don't know if that answers your question?

Also, another thing that bothers me with your code
Why did you make your music with song lenghts of just 3 notes each that you switch between? That was just an example and not how it was intended to be used for real songs. You know you can make a single song with hundreds of notes in it, right?
Edited by DanB on 2011/12/26 18:44
Top

#87
Re: Insect Combat
Posted on: 2011/12/26 21:03
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
Quote:

DanB wrote:
Why did you make your music with song lenghts of just 3 notes each that you switch between? That was just an example and not how it was intended to be used for real songs. You know you can make a single song with hundreds of notes in it, right?

Because the compiler doesn't like the following:

u16 song
[] = {F_3C_4F_3B_3B_3C_4C_4F_3AS3F_4AS3E_4E_4F_4F_4AS3F_3C_4F_3B_3B_3AS3GS3G_3};


By the way, the reason it didn't like that other code is because I think you forgot a semicolon at the end of the last line. Shouldn't it be: *currCell |= (chseg << 9);
Top

#88
Re: Insect Combat
Posted on: 2011/12/26 22:32
VUE(xpert)
Joined 2003/9/3
Sweden
393 Posts
PVBCC EntryHighscore Top10CoderHOTY09 2ndLong Time User (9 Years) PVBCC 2010 1st20+ Game Ratings
Quote:

Because the compiler doesn't like the following:

u16 song
[] = {F_3C_4F_3B_3B_3C_4,
  
C_4F_3AS3F_4AS3E_4E_4F_4F_4,
  
AS3F_3C_4F_3B_3B_3AS3GS3G_3};



There shouldn't be a problem with that... What's the error message? Try adding a const before u16 (look in one of the BGMap *.h files that you export from VIDE to see how it's done there)

Quote:

I think you forgot a semicolon at the end of the last line. Shouldn't it be: *currCell |= (chseg << 9);

Yes it should Glad you found the problem. (I haven't actually tried the function, just wrote it off the top of my head. Hope it works )
Top

#89
Re: Insect Combat
Posted on: 2011/12/26 22:57
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
This is what I get regardless of whether or not I put a "const" before "u16":

Attach file:



png  icerrormessage.png (34.35 KB)
768_4ef8eda7b2b08.png 667X331 px
Top

#90
Re: Insect Combat
Posted on: 2011/12/26 23:03
PVB Elite
Joined 2008/4/26
USA
526 Posts
CoderContributorLong Time User (5 Years)Top10 PosterHOTY09 3rdPVBCC 2010 Entry
Found the problem on my own! It appears it didn't like my definition of the song inside int main(). But I have a different question now, which shouldn't take long to answer. In my song, all the even numbered notes (including 0) have a different length than all the odd numbered ones. Is there an easy way to tell it to do something if it's an odd numbered note instead of an even numbered one? Something like
if the note is an odd number then currNoteLength=300, else currNoteLength=500?
Top

 Top   Previous Topic   Next Topic


Register To Post

You are not logged in.
Lost Password?
Register Resend Activation