Done both: https://github.com/NagyD/SDLPoP/commit/ ... 4e1cb5de47
New Mod Doubts
Re: New Mod Doubts
Re: New Mod Doubts
The reason that does not work is because of the sequence table that drives the game. When prince is standing and no keys are pressed it keeps looping in a sequence that sets the standing frame and a corresponding action to the "Kid" variable. When you press an arrow key the pointer to the sequence table moves and now are you in the running sequence until the key is released and so on.Akruzen wrote: ↑September 26th, 2021, 12:41 pm Any idea how to set prince to a particular frame? I tried settingin a if statement but that doesn't affect prince at all. The rest of the code in that if statement works, so the statement is reachable.Code: Select all
Kid.frame = frame_106_fall;
As David has mentioned, you can set the sequence that can last several frames. But it sounds to me like you really want to store the last few prince's moves.
Take a look at how the "do_auto_moves()" function works that is used to drive shadow on different levels as well as the initial demo at the end of credits when you start the game. The "replay.c" file does something very similar by allowing you to replay the entire level but I am not too familiar with that code.
Re: New Mod Doubts
The kid's current frame is overridden by play_seq() in every frame.Akruzen wrote: ↑September 26th, 2021, 12:56 pm Thank You for prompt reply David, however, I don't want to start any animation. I want prince to take a certain frame for 1 frame. That's why I tried putting the if statement in timers() function in seg003. Though the rest get's executed in the timer, prince doesn't change its frame for that particular moment. Any idea how to do this?
In play_kid_frame(), put an if statement around the play_seq() call, with a condition that is false if your custom timer is active.
Re: New Mod Doubts
Thank You David, that helped me to achieve the feature I wanted to add.
Is there any variable which holds the value of the room the potion is in? For example a special potion in room 8 of level 7 does a different action than default. To achieve that I added an if condition in the drinking function pickable object with conditions:
Code: Select all
if((current_level == 7) && (curr_room == 8))
Also, where is the code that executes when a level starts? I want some values of variables to be reset when the level restarts (by dying, ctrl+a) and some other functions to be executed when the next level starts (either by ctrl+l or normally). But since there are multiple ways by which this can happen I have to write the same code at multiple locations. Any work-around for this?
What if life is a video game and Déjà Vu are just checkpoints?
Re: New Mod Doubts
"curr_room" is the correct variable but it gets changed any time the code is getting tile information. So here is what is probably happening.Akruzen wrote: ↑October 6th, 2021, 6:47 pm Is there any variable which holds the value of the room the potion is in? For example a special potion in room 8 of level 7 does a different action than default. To achieve that I added an if condition in the drinking function pickable object with conditions:However, since the potion is located at the end of the room prince can drink it other room too by crouching and pressing shift which then breaks the code. Is there any alternative for "curr_room"?Code: Select all
if((current_level == 7) && (curr_room == 8))
1. prince picks up the potion, curr_room is valid
2. animation/sequence starts and moves prince into another room
3. tiles get drawn and the curr_room value changes
4. your code gets the wrong value
I think you need to define a new global variable and set it to "curr_room" in "proc_get_object" or "do_pickup" method.
Here is the code that restarts the level. The nested "else" statement on line 390 is executed when the next level starts.Akruzen wrote: ↑October 6th, 2021, 6:47 pm Also, where is the code that executes when a level starts? I want some values of variables to be reset when the level restarts (by dying, ctrl+a) and some other functions to be executed when the next level starts (either by ctrl+l or normally). But since there are multiple ways by which this can happen I have to write the same code at multiple locations. Any work-around for this?
https://github.com/NagyD/SDLPoP/blob/80 ... 003.c#L381
Re: New Mod Doubts
Thank You Dmitrys, that saved me a lot of lines. Could you also tell me how to copy a tile located at a particular room, column and row? I want to assign that tile elsewhere in the room. Basically I want to tell the compiler:
"See which tile is at Room 2, Column 4, Row 0 and place that tile to Room 1, Column 5 Row 0."
I tried to use
Code: Select all
curr_room_tiles[curr_tilepos] = tiles_0_empty;
I also added your code in check_gate_push, but prince always seems to be able to pass from right to left (i.e. when he is facing right and gate is to left of prince). Your patch however solved the bug where Prince could go from left to right with drawn sword. Note that in this mod prince can draw sword anywhere and also doesn't sheathe the sword automatically.
Last but not the least, how can I shift the position of prince by one tile to the left? I don't want his animation to be interupted nor his y value. I tried Char.x -= 20; but that is not helping.
What if life is a video game and Déjà Vu are just checkpoints?
Re: New Mod Doubts
Here is how you can copy a tile.Akruzen wrote: ↑October 8th, 2021, 8:56 pm Thank You Dmitrys, that saved me a lot of lines. Could you also tell me how to copy a tile located at a particular room, column and row? I want to assign that tile elsewhere in the room. Basically I want to tell the compiler:
"See which tile is at Room 2, Column 4, Row 0 and place that tile to Room 1, Column 5 Row 0."
I tried to usebut the problem with it is you always have to manually mention which tile should be placed on right hand side of the equal to sign. In my case, the RHS of the statement is to be decided dynamically (note that the room of the tile to copy is different than the room where it has to be pasted) depending on the type of tile at given room-col-row, since the tile to copy changes numerous times.Code: Select all
curr_room_tiles[curr_tilepos] = tiles_0_empty;
Code: Select all
byte tile_1 = get_tile(/* tile_1_room, tile_1_col, tile_1_row */);
byte tile_1_modif = curr_room_modif[curr_tilepos];
get_tile(/* tile_2_room, tile_2_col, tile_2_row */);
curr_room_tiles[curr_tilepos] = tile_1;
curr_room_modif[curr_tilepos] = tile_1_modif;
// if tile2 room is the drawn_room
redraw_height = 63;
set_wipe(curr_tilepos, 1);
set_redraw_full(curr_tilepos, 1);
That does not seem to happen in my mod. You would have to debug what the curr_tile2/tile_col values are set to in check_gate_push. The issue here is the dx_weight() value is typically -13 in frames when the sword is drawn that puts the center of the the tile almost a full tile back from the center of the frame.Akruzen wrote: ↑October 8th, 2021, 8:56 pm I also added your code in check_gate_push, but prince always seems to be able to pass from right to left (i.e. when he is facing right and gate is to left of prince). Your patch however solved the bug where Prince could go from left to right with drawn sword. Note that in this mod prince can draw sword anywhere and also doesn't sheathe the sword automatically.
That also creates another problem where kid can fall through the floor while drawing the sword when there is an empty tile behind him even when the distance from it is pretty big (10+ pixels).
Each tile is 14 pixels wide. If you know the exact column number, do this:
Code: Select all
// there are 5 off-screen columns on each side of the room, 7 pixel offset puts prince in the middle of the tile
Kid.curr_col = /* col_number */;
Kid.x = x_bump[/* col_number */ + 5] + 7;
Code: Select all
// assumes loadkid() was called earlier to assign Char to Kid
Char.x = char_dx_forward(-14); // a positive value would move him forward
determine_col();
Re: New Mod Doubts
Existing variables are reset here: https://github.com/NagyD/SDLPoP/blob/80 ... c#L81-L105dmitry_s wrote: ↑October 7th, 2021, 4:09 pmHere is the code that restarts the level. The nested "else" statement on line 390 is executed when the next level starts.Akruzen wrote: ↑October 6th, 2021, 6:47 pm Also, where is the code that executes when a level starts? I want some values of variables to be reset when the level restarts (by dying, ctrl+a) and some other functions to be executed when the next level starts (either by ctrl+l or normally). But since there are multiple ways by which this can happen I have to write the same code at multiple locations. Any work-around for this?
https://github.com/NagyD/SDLPoP/blob/80 ... 003.c#L381
You can use `if (level_number != current_level)` to see whether the player moved to the next level, or restarted the current level.
Re: New Mod Doubts
Since I don't want Prince to be placed at a fixed column, I used the later code which moves prince to 14 pixels left. However it is not working. He stands where he is. Any idea why? I even called loadkid() in the previous line after some attempts just to be safe.dmitry_s wrote: ↑October 9th, 2021, 12:12 amEach tile is 14 pixels wide. If you know the exact column number, do this:
Or to move prince back 14 pixels you can doCode: Select all
// there are 5 off-screen columns on each side of the room, 7 pixel offset puts prince in the middle of the tile Kid.curr_col = /* col_number */; Kid.x = x_bump[/* col_number */ + 5] + 7;
Code: Select all
// assumes loadkid() was called earlier to assign Char to Kid Char.x = char_dx_forward(-14); // a positive value would move him forward determine_col();
Also does copy tile copy the state of the door opened? For example, if the door is opening and it gets pasted in the room, does the door's portion of opened part also remain same? The code misbehaved when I tried to do it. Same goes with even pressure plates. I want them to retain the event they were assigned before pasting in the room.
What if life is a video game and Déjà Vu are just checkpoints?
Re: New Mod Doubts
Try adding savekid() after the move.
Re: New Mod Doubts
The modifier should copy the state of the plates. But events are trickier. So if a gate is opening/closing, you would have to trigger it.Akruzen wrote: ↑October 9th, 2021, 8:16 pm Also does copy tile copy the state of the door opened? For example, if the door is opening and it gets pasted in the room, does the door's portion of opened part also remain same? The code misbehaved when I tried to do it. Same goes with even pressure plates. I want them to retain the event they were assigned before pasting in the room.
Re: New Mod Doubts
Thanks, adding that line helped. Do you know how to shift jaffar to a certain column too? Also even if I used
Code: Select all
seqtbl_offset_opp(102);
What if life is a video game and Déjà Vu are just checkpoints?
Re: New Mod Doubts
It would be very similar.Akruzen wrote: ↑October 12th, 2021, 5:05 pm Thanks, adding that line helped. Do you know how to shift jaffar to a certain column too? Also even if I usedto make Jaffar do a hand rise, he just continues without executing anything. Any idea how to do that too?Code: Select all
seqtbl_offset_opp(102);
Code: Select all
loadshad();
Char.x = x_bump[5 + col_number] + 7;
Char.curr_col = col_number;
seqtbl_offset_char(102);
saveshad();
play_seq();
Re: New Mod Doubts
Hello Everyone,
I have been working on this mod for quite a while now and now that it has been finally finished, I wish to release the beta version of the same. Kindly give your suggestions.
GitHub Link:
Prince of Persia - The Maharaja's Palace
Kindly compile the project and run it.
P.S. Please do not post any walkthrough videos until public version is released. Thank You!
I have been working on this mod for quite a while now and now that it has been finally finished, I wish to release the beta version of the same. Kindly give your suggestions.
GitHub Link:
Prince of Persia - The Maharaja's Palace
Kindly compile the project and run it.
P.S. Please do not post any walkthrough videos until public version is released. Thank You!
Last edited by Akruzen on October 13th, 2021, 2:35 pm, edited 1 time in total.
What if life is a video game and Déjà Vu are just checkpoints?
Re: New Mod Doubts
Could you please help me fix it? I have posted the GitHub link in the previous post.dmitry_s wrote: ↑October 9th, 2021, 12:12 am
That does not seem to happen in my mod. You would have to debug what the curr_tile2/tile_col values are set to in check_gate_push. The issue here is the dx_weight() value is typically -13 in frames when the sword is drawn that puts the center of the the tile almost a full tile back from the center of the frame.
What if life is a video game and Déjà Vu are just checkpoints?