accousticguitar Posted November 3, 2007 Share Posted November 3, 2007 I put this question in the hack section, but I think it is really a programming question. This is a randomizing routine for an Adventure hack. I keep getting 3 or 4 objects in the same room on a regular basis. I changed the code but it still didn't work. The parts in bold are added in, and I took out 3 LSR's. Shouldn't the CMP command compare the previous item's room number with the current one and start the routine over if they are the same? ;Put objects in random rooms for level 3. RandomizeLevel3: LDY #RndNum RandomizeLevel3_2: LDA LoCnt LSR LSR SEC ADC LoCnt STA LoCnt AND #RndMax CMP Loc_2,Y BCC RandomizeLevel3_2 CMP Loc_3,Y BEQ RandomizeLevel3_3 BCS RandomizeLevel3_2 CMP VSYNC,X BEQ RandomizeLevel3_2 RandomizeLevel3_3: LDX Loc_1,Y STA VSYNC,X DEY DEY DEY BPL RandomizeLevel3_2 RTS Here is the room bounds data that goes with it. ;Room Bounds Data. ;Ex. the chalise at location &B9 can only exist in rooms 13-1A for ; level 3. Loc_1: .byte ChaliseR ; Loc_2: .byte $16 ;Chalise was 01 Loc_3: .byte $53 ;was 3A .byte YKeyR,$01,$3A ;Yellow Key .byte WKeyR,$01,$43 ;White Key .byte BKeyR,$01,$37 ;Black Key .byte RKeyR,$01,$24 ;Red Key .byte SwordR,$01,$6D ;Sword .byte BridgeR,$01,$6D ;Bridge .byte MagnetR,$01,$6D ;Magnet .byte BatR,$01,$6D ;Bat .byte RDragonR,$01,$6D ;Red Dragon .byte YDragonR,$01,$6D ;Yellow Dragon .byte GDragonR,$01,$6D ;Green Dragon .byte BDragonR,$31,$6D ;Blue Dragon .byte FDragonR,$31,$6D ;Baby Dragon Loc_4: .byte <Game1Objects ;Pointer to object locations for game 01. Loc_5: .byte >Game1Objects ; --continued. .byte <Game2Objects,>Game2Objects ;Pointer to object locations for game 02. .byte <Game2Objects,>Game2Objects ;Pointer to object locations for game 03. Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted November 12, 2007 Author Share Posted November 12, 2007 I deleted "AND #RndMax" and now it seems to work better. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.