The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
July 12, 2024, 05:18:14 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Internals Question: String_Table
« previous next »
Pages: [1] Print
Author Topic: Internals Question: String_Table  (Read 2269 times)
Zebranky food
Offline Offline

Posts: 20


View Profile
Internals Question: String_Table
« on: August 05, 2008, 08:14:23 am »


I'm currently at work on a UQM patch of secret purpose. However, in order to make it work I have a feeling I will need to use the STRING_TABLE data structure. And looking through the code provides no hint as to how to pull individual string values from the table once it has been loaded from the game content.

Could someone who knows this code provide a helping hand? You can reach me on AIM, or at "ecomono asperand gmail point com" if you don't use AIM.

Thanks!  Smiley
« Last Edit: August 05, 2008, 08:38:06 am by Eco-Mono » Logged

Non nova, sed nove.
Forum Admin
Offline Offline

Posts: 2847

View Profile
Re: Internals Question: String_Table
« Reply #1 on: August 05, 2008, 11:36:13 am »

Loading the string table:
    STRING str = CaptureStringTable (LoadStringTable (SOME_STRTAB));
Selecting string 17:
    STRING str17 = SetAbsStringTableIndex (str, 17);
Getting the next string:
    STRING str18 = SetRelStringTableIndex (str17, 1);
Getting a pointer to the actual string data:
    char *strData = (char *) GetStringAddress (str18);
When you're done:
     DestroyStringTable (ReleaseStringTable (str));

src/sc2code/gamestr.h defines the 'GAME_STRING' convenience macro to get a pointer to a string by number:
    char *strData = GAME_STRING(18);

See src/sc2code/libs/strlib.h for more useful functions. The actual functions are defined in src/sc2code/libs/strings/strings.c.

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Pages: [1] Print 
« previous next »
Jump to:  

Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!