Infernal Machine working on modern machines

kohlmark

Member
IMfan said:
Can you please tell me how you hacked on your game? My game has cog strips too, but i do not know how to hack on them. Be awfully nice how to do that. ;)

Sry, but i am not able to tell you the method which was used for performing this tasks, cause I am not the programmer myself, which had done this.
The programmer was "Penumbra" of the german Indiana Jones Forum.
 

Marduk

New member
IMfan said:
Can you please tell me how you hacked on your game? My game has cog strips too, but i do not know how to hack on them. Be awfully nice how to do that. ;)

WARNING: this will be longer post

TL;DR: To give indy all available items put this code at the end of 00_cyn_opening.cog file just before return statement:
HTML:
for (bin= 0; bin < 200; bin = bin + 1) 
{
   SetInv(player, bin, GetInvMax(player, bin));                     
   SetInvAvailable(player, bin, 1);
}
Make sure to backup file first!



##############################################
I'll try to make this post as short as possible :whip:
All information about cog scripts can be found here and here

I assume that you already know how to extract COG scripts from GOB files.
By the way, if you need a tool to do that I've made one: gobext.exe

Brief intro to COG scripts
From jkhub:
The COG Scripting Language is an event-driven imperative scripting language designed to help level designers write simple interactivity without requiring extensive programming experience. While COG was initially developed as an incremental improvement over the INF Scripting Language used in Dark Forces, COG quickly grew into a more complete language as the level designers continued to request more advanced features.
Cog scripts are logic behind the game. They are used to define game level opening animation, special effect when player enters some section within level,
they also define AI action on some special event eg. when hit by the bullet or what to do when the enemy is spotted etc...
Fundamentally COG scripts consist of two sections: symbols and code.
Each section begins with section name(symbols or code) and ends with word "end"
HTML:
symbols
# Comments

symbols
[Symbol List]
end

code
[Compound Statement]
end

Symbols section is a list of variables described by their type followed by their name, optionally including a default value and a list of extensions.
Example of symbol section
HTML:
Symbols
    # Example outlines
    message    startup    # message type is a "function" within code section
                          # that can be called from game engine when compiled.
    keyframe   in_handsOnHips=0in_stand4.key   local
    material   topMat=pyr_jeep_top.mat         local
    sound      in_gotowork=Cn01j01.wav         local
    thing      player                          local # This is you, game player.
    thing      indy                            linkid=0 # actor indy for cinematic movies. you will see a lot of this definitions in cog scripts which define game levels.
end

Note that some variables such as things and keyframes are initialized by game engine when loading cnd file
and you don't have much control over it, for now I'm still working on it ;)

Code section contains a C-style compound statements of code with messages indicated by C-style label statements. Note that every line of code that is not a comment (comments begins with '#') or a loop (for(){}) has to end with semicolon ';'

HTML:
code
startup: # Note the name that we've declared in symbols section

	SetMasterCog(GetSelfCog());
	Sleep(0.001); # Let engine get set up

	SetThingAlpha(fadeplate, 1.0);
	SetThingAlpha(fadeplate1, 1.0);
	SetThingAlpha(fadeplate2, 1.0);
	SetThingAlpha(maintitle, 0.0);
	SetThingAlpha(placetime, 0.0);

	SetCameraLookInterp(2, 0);
	SetCameraPosInterp(2, 0);
	SetCameraFocus(2, cam_1);
	SetCameraSecondaryFocus(2, ct_1);
	SetCurrentCamera(2);
	SetCameraFOV(25, 0, 0);

	return;
end

I hope that this very brief crash course has made the cog scripts a little bit clearer.


Ok let's move on to real example :)
For the purpose of this short tutorial, I will be editing canyon lands opening script 00_cyn_opening.cog. Make sure to backup file before continue. To run this script you have to start IM from the beginning. All code in this tutorial will be written at the end of cog file just before the return statement:
HTML:
 # RT: Give 'im a snake bite kit...
	SetInv(player, 46, 1);
	SetInvAvailable(player, 46, 1);

---> All code goes in here

	return;

end

For start, let's make the gravity a little bit lighter. By the default the gravity is set to 2.0 let's make it 1.0. To do that just write this line: SetGravity(1.0);
In the game try to jump in the air and see what happens ;)

Give Indy weapon:
Now let's give Indy a Simonov SKS rifle. Under the previous line write this two lines:
SetInv(player, 6, 500);
SetInvAvailable(player, 6, 1);


SetInv function gives indy inventory at the number 6 (Simonov rifle) and sets rifle's ammo to 500. The SetInvAvailable makes rifle available to indy (1- true, 0 - false). Note the 'player' object is type of thing. It was defined in symbols section of this cog script and initialized by the game engine. Instead of player thing you could use any other thing that is of type actor eg. you could also change inventory of an enemy with this two functions.

All Items:
Let's give Indy all available items (200). We'll use for loop to achieve this:
HTML:
for (bin= 0; bin < 200; bin = bin + 1) 
{
   SetInv(player, bin, GetInvMax(player, bin));                     
   SetInvAvailable(player, bin, 1);
}

You should now have all available items:
14WdoiO.png


HuNUtKK.png


ueMzh2e.png



Make Indy Invulnerable:
SetActorFlags(player, 0x8);

Flags are thing's properties that can be set or unset. Flag Ref


Flying indy:
Now let's make something interesting. Let's make indy fly :cool:
First comment out or remove the line that sets gravity (SetGravity(1.0);).
Then put this two lines:
HTML:
ClearPhysicsFlags(player,0x1);   # set player to have no gravity
SetPhysicsFlags(player, 0x2000); # player can fly

In game use jump key to fly up and crouch key to move down.
g9crbr4.png





I hope that this long post will help you mod IM. Note that with cog scripts you can modify everything including the shape of game level. But for now this is hard to do because you have to know symbol variables that are packed in cnd file. I'm working on conversion tool to convert cnd file to NDY file which is text based level definition file. If you are interested I've made tool to extract and replace materials in cnd files. You can find more info about this in my post here.

Happy modding :whip:
 

IMfan

New member
Thank you! But how can you backup a COG file? And every time I try to save a COG file it shows "access is denied". Is there anyway to bypass that? I'm using Notepad to edit these COG files
 
Last edited:

IMfan

New member
Never mind, i figured it out, but it's complicated. Can you please tell me where I put the codes at? :gun:
 

Marduk

New member
Put the code at the end of 00_cyn_opening.cog script file just before the "return" statement and run the game from the start (1st level).
 

Marduk

New member
I haven't tried it but there are two script files "cheat_allweapons.cog" and "cheat_whatailsya.cog" which i think are invoked when you type in cheat "urgon_elsa". Maybe try to edit them and see if it works ;)
 

IMfan

New member
Thanks. But my game does not have the cog strips "cheat_allweapons.cog" and "cheats_whatailsya.cog". Do i type in the cheat code first or after in-game?
 

IMfan

New member
Yes, all of that is on my resource file. I used Markus Egger's installer to install Indiana Jones and the Infernal Machine and the update. Any external program?
 

Marduk

New member
do you have "COG" folder with *.cog files in it after extraction? you can also try extraction tool that i have made: gobext.exe
(it doesn't provide any gui, you have to run it from cmd prompt)
 

dprog

Active member
Thanks for the installer Man. I Managed to finally finish this game on windows 7.(when i was a kid my second disc of the game was broken so i only managed to play it til mission 7 back then)

I have found an Easy workaround for Item/Inventory bug:

1.when it happens, find another item. it may fix it.

2.in 90 percent of the times there is no need for using inventory.(you can use shortcut keys instead for weapons and artifacts)

3.and there are some times where you really need to open the inventory. for that you can quicksave via F5, then Alt-F4 the game. and after that load the quicksave.

by the way aside from the Inventory/Item bug there is also a Grey Screen Bug that may happen when picking up an item.(you can only see the HP bar)

Edit: I also realized that the first cutscene will play correctly(with it's sounds) only if you disable the desktop composition when running the game.
 
Last edited:

kohlmark

Member
Youré welcome.

But only the hint was from me, the tech work has been done by "penumbra" and "malte"
These guys are still working on the installer, integrating dgVoodoo2 as optional choiseable install option.
The *.sdb files have alread been updated to be comaptible to Windows 10 1703.

dgVoodoo2 integration should and will fix the problem, that some users are not able to see the ingame map and will be not able to use map and hint function.
This often happens, playing the game on devices with no dedicated video card / video chip, specially using Intel onbard graphics ore cpu integrated Video chips
 
I just installed the game with the 64bit installer but it refuses to play fair.

The first level works just fine but in the second level the issues start to pop up including I think the inventory/esc bug problem people here describe.
Sometimes it is not possible to access these.

The game also gets "stuck" from time to time when using the inventory/options menu and the afterwards it becomes impossible to close the game.
I had to reset my computer once when that happened.

I guess I should install the game if I ever want to play it again on "native" hardware and OS.

On a sidenote, I have forgotten how tank like the controls are.
After having played Emperor's Tomb it is such a drastic step back.
 

IMfan

New member
Sorry for my really late reply, I did all that, and when I enter the code "urgon_elsa" for all weapons, and it never works :/, I just need to make the best of it, thanks for the info. (y)
 

dprog

Active member
TheDutchGhost said:
The game also gets "stuck" from time to time when using the inventory/options menu and the afterwards it becomes impossible to close the game.
I had to reset my computer once when that happened.
I remember that ALT+F4 worked well for closing this game.You can also use your Task Manager for it.(Ctrl+Alt+Delete) No need to restart the game really.

As for inventory bug, in most areas you don't really need inventory since you can select weapons via shortcuts.(And use F5 key for quick saves and F8 for quick loads if I remember correctly)

The inventory bug has the chance to disappear when picking up new items so imo it isn't necessary to quit the game unless you really need to access the inventory.
 
Top