• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Need Modding Help - First Person Immersion

leadfoot

Landlubber
I am new at modding PotC and haven't really gotten a feel for the layout of the files. So let's throw this idea out and see who can do something with it.

I am currently trying to make a mod that will change the default camera from the third person follower to the 1st person view. But it turns out to not be as easy as I first thought. Whenever nearing a door or entering fight or dialogue mode, the camera switches back to the follower.

How could I change the behavior of the game so that the game starts in fist person mode and stays there until manually changed?
 
Come now, there must be someone with some kind of input? I'm not looking for handouts, I'm looking for help. So we're looking on how to have a first person fight mode... okay

So I've grepped the PROGRAM directory for any reference to cameras and the files that I got were:

CONTROLS/controls.c
CONTROLS/init_pc.c
CONTROLS/init_xbox.c
Characters/characters_events.c
INTERFACE/option_screen.c
INTERFACE/option_sl.c
Locations/init/Conceicao.c
Locations/init/IslaMuelle.c
Locations/init/Oxbay.c
Locations/init/Redmond.c
Locations/locations.c
Locations/locations_camera.c
Locations/locations_init.c
Locations/locations_loader.c
QUESTS/quests.c
QUESTS/quests_reaction.c
SEA_AI/AICameras.c
SEA_AI/AIShip.c
SEA_AI/Script_Defines.h
SEA_AI/telescope.c
Weather/WhrLightning.c
WorldMap/worldmap_init.c
messages.h
seadogs.c

So as you can see, there are plenty of files having something to do with cameras in one way or another... okay, but which ones control the fight cameras? or the dialog cameras? A grep for 'fight' brings up:

BATTLE_INTERFACE/LandInterface.c
BuildSettings.h
CONTROLS/controls.c
CONTROLS/init_pc.c
CONTROLS/init_xbox.c
Characters/actionsattributes.txt
Characters/characters.c
Characters/characters_ai.c
Characters/CharacterUtilite.c
Characters/init/TempQuestCharacters.c
DIALOGS/(quite a few in here, mostly to enter fights after talking to someone)
INTERFACE/interface.c
INTERFACE/option_screen.c
LandEncounters/LEnc_monsters.c
Loc_ai/doc/character_type.tx
Loc_ai/doc/functions.txt
Loc_ai/(more stuff)
Loc_ai/templates/(and more and more stuff)
Loc_ai/types/(ahem more stuff)
Locations/init/(all the islands)
Locations/locations_loader.c
Locations/location_init.txt
Models/models.c
QUESTS/both_reaction.c
QUESTS/characters_task.c
QUESTS/quests_reaction.c (quite alot of matches here)
QUESTS/quests_scenes.c
Rumour_Data.c
SEA_AI/AIFantom.c
Weather/Copia di Init/DayStorm.c
Weather/Init/DayStorm.c
messages.h
reload.c
seadogs.c

So the files this functionality must be contained in are one or more of the following:

CONTROLS/controls.c
CONTROLS/init_pc.c
CONTROLS/init_xbox.c
Characters/characters.c
Characters/characters_events.c
Locations/locations_loader.c
messages.h
seadogs.c

Must go try things with this new knowledge now. If I don't return, tell my momma I love her.
 
Well I've explored shotgun mode... and while it's fun for a bit, it disables alot of the things that make this game great... like any fun whatsoever. No dialog, no items, everything is disabled. What's more, the shotgun mode appears to be hardcoded to be how it is, so no modifications seem possible...

Also, theres quite a few views, but absolutely no replies to this topic. Am I way off base here? Do you guys think this would be a stupid idea? Come on, say something!
 
I suspect that you've not had any response because not many people would want to play the game from a First Person perspective.

Possibly the only way that you might get this to work would be to modify all of the dialogs so that when they are complete then you would go back into First Person. There are hundreds of dialogs so that would need a lot of coding and months of work.

As for the camera changes with the doors then I suspect that you are not running with the latest Build as it has an option to change it so that the camera angle doesn't change when getting near to doors.
 
And the code for that is in characterscharacters_events.c. Look for "case "camdetector" "

I would love to have default FVP and FPV fighting, but at the moment I have no idea how to do that, sorry.

Only a vague idea: if you fight near a wall the follow camera often zooms closer to the player until you have a quasi FPV. Maybe it is possible to shorten the distance the "follow" camera has from the player to zero. That would turn the follow view into a quasi FPV always and everywhere... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mellow.gif" style="vertical-align:middle" emoid=":|" border="0" alt="mellow.gif" />
 
Well let's see... I haven't yet found any code governing how the cameras work, just what mode they are in. So it appears that these are internal engine parameters. The quasi FP is a good idea, since if the follow was inside the person's head, not only would it always be FP, but the game wouldn't stop drawing the weapons and other stuff.... might make for a strange experience looking straight down (Is that what I look like inside? I expected more... guess that girl was right when she called me a hollow shell of a man <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> )

But the dialog changes shouldn't take too long, not with a SDK (find/replace)

Or possibly I could change the code that governs switching of the camera modes, so that no matter what the game tries to do, all commands do a FPV. But in order to do that, I'd need to know where these commands are. LOCATIONS/locations_camera.c doesn't seem to do it... or at least theres no locCameraFPV() function that I can find. Free mode detatches the camera completely from my character, and Follow is just the default...

Is it possible to call locCameraToPos() and tell it to center the camera at the player?

Hmm... ideas to mull over in my head. I'll be back later to try something out.

Note: What I'm trying to do is add on to the build in such a way that underneath LOC_CAMERA in Buildsettings.h there would be a FP_CAMERA toggle, so one could choose whether or not to use this new view... That's the easy part, I've already added about 20 switches to my build, like DISABLE_INTROMOVIE (can't stand to be innundated by the Disney logo every startup)
 
hi leadfoot, welcome!

i've just had a little bit of a look at the files - sorry if you already knew this...

looks to me like locCameraFree() sets the camera to first person (why the function has that name i don't know) and locCameraFollow() sets it to the follow position. locCameraSwitch() alternates those, as long as locCameraEnableFree == true, and that is the function that is called every time the player presses the TAB key.

i reckon that after dialogues and fights there must be some bit of code that calls one of those functions (and probably sets locCameraEnableFree to false), and it seems unlikely that that would be `hard-coded`. but then i haven't looked thoroughly <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
<!--QuoteBegin-Kieron+--><div class='quotetop'>QUOTE(Kieron)</div><div class='quotemain'><!--QuoteEBegin-->looks to me like locCameraFree() sets the camera to first person <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

Umm, I'm afraid CameraFree is the "Free camera" mode where the camera is disconnected from the player and you can fly over the model with the mouse. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />

But the hint with the controls is a good one. If one followed the code that is being triggered by the "switch view" key one should be able to find the command for FPV...
 
oh <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" />:

is it definitely? it's just that i followed the code from controlsinitpc.c onwards, and found that the following function seems to be triggered by the control <b>ChrCamCameraSwitch</b>:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void locCameraSwitch()

{

    if(locCameraEnableFree == false) return;

    string controlName = GetEventData();

    if(controlName != "ChrCamCameraSwitch") return;

    if(locCameraCurMode != LOCCAMERA_FREE)

    {

 locCameraFree();

    }else{

 locCameraFollow();

    }

}<!--c2--></div><!--ec2-->

so it switches between locCameraFree and locCameraFollow, which made me think locCameraFree was the `1st-person` camera, despite the name.

there's another function locCameraToPos, which sounds like maybe it sets the camera free at a certain position?
 
Yeah that is most deffinitely the case. locCameraFree() sets the camera into a mode that doesn't seem to be activated anywhere else. Hmm... how do I add debugging code? IE I want stuff displayed to the onscreen log wherever I put the commands in... like this pseudocode:

if blah
{
dosomething();
writetolog("called dosomething()");
}
 
<!--QuoteBegin-Kieron+--><div class='quotetop'>QUOTE(Kieron)</div><div class='quotemain'><!--QuoteEBegin-->oh <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" />:

is it definitely? it's just that i followed the code from controlsinitpc.c onwards, and found that the following function seems to be triggered by the control <b>ChrCamCameraSwitch</b>:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void locCameraSwitch()

{

    if(locCameraEnableFree == false) return;

    string controlName = GetEventData();

    if(controlName != "ChrCamCameraSwitch") return;

    if(locCameraCurMode != LOCCAMERA_FREE)

    {

 locCameraFree();

    }else{

 locCameraFollow();

    }

}<!--c2--></div><!--ec2-->

so it switches between locCameraFree and locCameraFollow, which made me think locCameraFree was the `1st-person` camera, despite the name.<!--QuoteEnd--></div><!--QuoteEEnd-->
Initially I drew the same conclusion, cause this codesection is in fact the only one connected to the "ChrCamCameraSwitch" which switches to FPV. But actually this codesection is a special case that runs only if the cheat "Free view" is enabled. It makes the "Change View Key" switch to the free birdview if locCameraEnableFree is true. You can easily check that if you outcomment this line:

// if(locCameraEnableFree == false) return;

FPV seems to be a special case of locCameraFollow cause every time you pass a door this section from characters_events.c runs, and the final locCameraFollow does NOT switch FPV off.

case "camdetector":
// CCC -->
if(LOC_CAMERA)
{
locAttr = "locators.camera." + locator;
if(CheckAttribute(loc, locAttr) != 0)
{
x = MakeFloat(loc.(locAttr).x);
y = MakeFloat(loc.(locAttr).y);
z = MakeFloat(loc.(locAttr).z);
locCameraToPos(x, y, z, false);
}
}
else { locCameraFollow(); }
// CCC <--
break;

But I have found so far no code dealing with FPV, neither by following the "Change View Key" code nor by the "Draw Sword Key" track. Both `dead-end` in SendMessage( commands which may lead to hardcoded sections <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
okay well I thought I was just retarted for a while, but you guys are quickly confirming my fear that there may be no way to do this with our current level of knowledge... if only Akella would release JUST the definitions of their engine's routines in code, it might be possible (and a whole lot more)...
 
You can _try_ the following, but I dunno if it'll work (this is what you suggested earlier btw but fleshed out a bit)
Somewhere (on keypress) set up postevent() statement with a delay of say 5ms.
Have it call a function, cam_to_head
in that, use setcamerapos(getCharacterpos)
then `re-post` the event (so the func runs _again_ in 5ms.

That's all I can think of offhand (and I too am an FPV lover, and would indeed like to see this).
 
Back
Top