Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP - Matrix1Utils - Parsing Array Pointers (UDT) to functions - simple example1 on how to flag duplicate records and delete from array]

Bored of the Rings
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 12th Jul 2018 00:01 Edited at: 18th Jul 2018 09:46
More fun with Array Pointers and Parsing them to functions. The example code below, reads in a DBO file (FPSC fully textured level) and stores each found texture file name into an array. The array is then sorted, and duplicates are flagged and finally deleted from the array. All by using array pointers. Tons I could do with this code to improve. I've used memblock here, but you can use banks or alloc/make memory.

The example is also good for anyone who wants to only load in a unique file for image ID storage, thus saving on resource/memory.

[update 1 17Jul18: I've excluded reading any blank strings by adding "AND pBLOCK <> 0"]

[update 2 17Jul18: Code updated to read in a DBO file containing a FPSC level with loads of textures (hint: DirectX texturefilename=). DBO file attached. In addition, added a new couple of useful functions at end of code. Hope this helps anyone wanting to do some more complicated stuff with string/array pointers/DBO to X conversion/exporting etc......]

[update 3 17Jul18: Another update, added a function to return field type as a long string e.g. S = String. It uses the get arrayptr field type(rlptr,f) command. Will be making the functions more generic.]

Notice also, that for each UDT field that you add, the array format gets longer and the offsets for each field goes up a DWORD in size i.e. 0,4,8,12 etc

[update 4 18Jul18: added undim arrayptr rlptr at end of code for completedness. Updated ShowArrayStatus function.. Saves array contents to file, so additional params added. now determines the field type and processes accordingly]

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others


Login to view attachments

Login to post a reply

Server time is: 2018-07-23 03:26:12
Your offset time is: 2018-07-23 03:26:12