Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I don't know what exactly you're doing so I'm going off some guesses here, and I don't know exactly how Portal works, but I'll give it a go.
So what these errors are saying essentially is that they can't find a referenced function or object.
Taking a look at the last one in prop_portal.obj, this means that in prop_portal.cpp it's trying to call UpdateGrabControllerTargetPosition() but it doesn't exist in your project.
From what I can tell this is defined in weapon_physcannon.cpp. You need to make sure you have both weapon_physcannon.cpp and weapon_physcannon.h, and you will need to add at least weapon_physcannon.cpp to your actual project.
This seems to depend on other Portal code, so you will need to go through and check what it depends on as well.
Also, I wouldn't expect something like this to magically work, you will probably have to refactor some code in the end to get it working.
Well, the gun i'm trying to add is kinda a replacement of the original "weapon_physcannon.cpp". So, should i rename my current weapon name back to "weapon_physcannon.cpp" ? And those are the Portal Project Beta codes i'm currently using and the weapon i tried to add was an a BIG edit of the physcannon and its even telling at then top as a comment "// Note: Remove weapon_physcannon from the project before installing." So, thats what i did...But, seems isnt magic as you said...What i'm going to do is try to rename it back and see if i can define those in the other .CPPs.
If you was curious about whats my mod i'm working on well here you go: http://www.moddb.com/mods/portal-last-hope
Welp...only one problem left now...but this one is in-game i cant load any maps...checked the console and it tells me this:
Do you know what can cause this error ?
Maps are loading perfectly now! But, the final problem...i think...is once i type in the console:
The game crashes...But the portalgun, atleast, is working...
Anyway, if you go into your Steam\dumps folder, you should see a .dmp file for each crash. It will be something like crash_hl2.exe_DATE_1.dmp. Open it with Visual Studio and click "Debug with Native Only"
It might complain about not being able to find symbols for hl2.exe or whatever, that's fine. The code for hl2.exe and whatnot isn't a part of the Source SDK.
In the lower right (normally) there should be something called the "Call Stack", hopefully if you look at the top-most part it will point you to where in your code it crashed. It should look something like this: http://i.imgur.com/HWYknbn.png
Stuff that is greyed out is typically something you don't have the source code for, but if it's not, you should be able to follow your code and find exactly where it crashed.
Ok cool, it bring me to this line in my edited physcannon code:
it was in a "bool" if you need the entire "bool" there it is:
thats what i just did now, i deleted the "highlight" line and the the one on the top too so now i have this:
Debugged again and now it gave me this file -> "spritemodel.cpp" at line 420 ... Here the entire "static unsigned int".
So take a look at your call stack and see if you can find where this CEngineSprite is that's calling GetMaterial(). Start from the top and work your way down. My only guess is that this has something to do with beams as I've been digging through the code. I would try messing with r_drawbeams and r_drawsprites to see if when they're off if it still crashes.
But yeah, look through the call stack and try to figure out where it's coming from.
It's also an IMaterial* not a static unsigned int. The static unsigned int is just a variable.
Ok, on my side i set "pMaterial" to NULL and it did crashed again, but now when i debugged it's another file which causing the crash and this time it's "hud_quickinfo.cpp" at line 222 in the Portal Project Beta codes... Here take a look:
I don't really know why this line causing something, but yea...
It seems like you may not fully understand how pointers work. A pointer is not an object. A pointer POINTS to an object. If you set it to NULL, it's pointing to nothing. So if you try to access it when it's pointing to NULL, it will crash, because you're trying to access something that doesn't exist.
On the flipside, if you declare a pointer without setting it to anything, or set it to an object that goes out of scope or is deleted, it becomes a bogus pointer, pointing to some random spot in memory.
pPortalgun is a pointer as you can see it's accessed by an arrow ->. Also Valve typically names pointers by putting a lowercase 'p' at the beginning of the variable name.
This means that pPortalgun is either NULL or bogus. I don't have the full code in front of me, so I can't say.
Also, just in case you aren't, you should try doing builds in Debug mode. You might get warnings about asserts when starting the game, you can click "Ignore All Asserts" (Also you'll probably want to run in windowed mode as sometimes the fullscreen hides those messages and it may look like the game froze)
Running in debug mode will make debugging more accurate and it should be easier to see what is happening in your call stack. Your call stack is your friend, and if you want to get better at programming in C++, you will need to get more familiar with the debugging tools. I know it can be intimidating, but it's an important process.
Don't worry...i'd like more feedbacks/comments/replies like this since those helps me alot in progression ! Now atleast i'll more carefull with those pointers and with debugging. You said you don't have the full code well it's the Portal Project Beta src codes if you want to take a look for help more here -> https://github.com/reepblue/project-beta <- Now i'm going to fix the "pMaterial" and retry with what you told me to do...