Seite 325 von 340 ErsteErste ... 225 275 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 ... LetzteLetzte
Zeige Ergebnis 9.721 bis 9.750 von 10174

C/C++ Programming Help Thread

This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Ah, thanks. -=Double Post Merge =- Does oslib have it's own collision detection functions? Because I haven't been able find ...

  
  1. #9721
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Ah, thanks.

    -=Double Post Merge =-
    Does oslib have it's own collision detection functions? Because I haven't been able find any tuts on it. Also, if it doesn't, are there any good collision detection tuts for regular c coding?

    Because I plan on making collision based on the color that you are touching.


    Geändert von Jmaxx (02-20-2009 um 05:18 AM Uhr) Grund: Automerged Doublepost

  2. #9722
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I'm not sure about OSLib, I never really used it. One of the most common (and easiest) methods is the Bounding Box method. Doing a Google search will probably give something better than that though. I used to have a good link for a collision detection tutorial but I can't find it anymore

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  3. #9723
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Jmaxx Beitrag anzeigen
    Does oslib have it's own collision detection functions? Because I haven't been able find any tuts on it. Also, if it doesn't, are there any good collision detection tuts for regular c coding?

    Because I plan on making collision based on the color that you are touching.
    no oslib doesn't have an inheriantly built collision system, but it's truely not hard, just check if the boundry around 1 object is touching another, as auromega said: bounding box method, also if you want to check color's simple have an internal check as to what is what color it is and add that to your collision checking code
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  4. #9724
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Hi, I have another question about the PSPGU.
    I have a square Vertex.
    I can now display the Vertex on the screen, but is it possible to display multiple squares (the same Vertex) on the screen?
    I want to make a simple grid like this:
    X X X
    X X X
    X X X
    The x' are the squares.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  5. #9725
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    3 options I can see;

    1. Redraw each vertex manually, shifting each of the coords by the same value.
    2. Shift your drawing position then draw the same vertex, using sceGumTranslate();
    3. Use a display list and set up each one manually, then you only need the draw/call the list once per loop.


    Examples of all are probably available from the samples folder in the SDK, or you could check on the PSP-Programming forums again, lesson 1 covers the first and second point, lesson 11 covers the last. The last option is by far the best when you start drawing lots of images.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  6. #9726
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    3 options I can see;

    1. Redraw each vertex manually, shifting each of the coords by the same value.
    2. Shift your drawing position then draw the same vertex, using sceGumTranslate();
    3. Use a display list and set up each one manually, then you only need the draw/call the list once per loop.


    Examples of all are probably available from the samples folder in the SDK, or you could check on the PSP-Programming forums again, lesson 1 covers the first and second point, lesson 11 covers the last. The last option is by far the best when you start drawing lots of images.

    -Aura
    Nah, I just want to make a bunch of squares like a chess board. I will check what is the best for me to do.

    Thanks again:Punk:
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  7. #9727
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    If you're drawing a chess board, I'd definatly go with the 3rd option, because it compiles when the list is created, which means you got speed (not doing all the math each time, it just draws) and simplicity (theres no complex section in the drawing code, once you've set the list you simply call it and never look back).

    The only time I've really found a display list isn't the best option is when drawing a dynamic set of images. The list is compiled which means its created once, and whatever you created is what will be drawn. Moving parts or random colours won't function properly for instance - on the other hand, you can still compile the section that doesn't move, and the section that does move, and then call the lists at different places, its basically what you do when you call vertices, although I'm pretty sure soft body physics would screw this up.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  8. #9728
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    If you're drawing a chess board, I'd definatly go with the 3rd option, because it compiles when the list is created, which means you got speed (not doing all the math each time, it just draws) and simplicity (theres no complex section in the drawing code, once you've set the list you simply call it and never look back).

    The only time I've really found a display list isn't the best option is when drawing a dynamic set of images. The list is compiled which means its created once, and whatever you created is what will be drawn. Moving parts or random colours won't function properly for instance - on the other hand, you can still compile the section that doesn't move, and the section that does move, and then call the lists at different places, its basically what you do when you call vertices, although I'm pretty sure soft body physics would screw this up.

    -Aura
    I want to make this (X = black | 0 = white | + = green):
    XXXXXX0XXX
    XXXX000XXX
    XXXX0XXXXX
    XXXX00XXXX
    XXXXX+XXXX

    The path (0's) will be created randomly and I want to be possible to move the + (player) along the path. Will this be possible with the 3rd method? I hope so because it sounds very easy :o
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  9. #9729
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Yep; you'll simply do everything as you planned originally. All a display list is, is a compilation of vertices. You'd do something like this:

    Code:
    //generate all the info you need to draw the map
    randomMap();
    
    //create the list using the information from the map
    createDisplayList();
    
    //draw the scene using the display list and whatever else you need to add
    drawScene();
    All-in-all its pretty simple, here is the GU tutorial on display lists, you should be able to understand enough of it to work out whats going on. Here is the NeHe tutorial, with probably a better explaination of the concept, just bare in mind thats in OGL and not PSPGU.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  10. #9730
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    Yep; you'll simply do everything as you planned originally. All a display list is, is a compilation of vertices. You'd do something like this:

    Code:
    //generate all the info you need to draw the map
    randomMap();
    
    //create the list using the information from the map
    createDisplayList();
    
    //draw the scene using the display list and whatever else you need to add
    drawScene();
    All-in-all its pretty simple, here is the GU tutorial on display lists, you should be able to understand enough of it to work out whats going on. Here is the NeHe tutorial, with probably a better explaination of the concept, just bare in mind thats in OGL and not PSPGU.

    -Aura
    Okay, will take a look at it. Thanks for all your help

    Edit
    Display Lists is nothing more than a cache of commands, which is important to keep in mind since once you create a display list, you cannot modify it.
    So the best thing to do is create an array with the path and other squares and if a key is pressed change the array and re-configure the display list?
    Geändert von basfreak (02-22-2009 um 10:36 AM Uhr)
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  11. #9731
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    How can you count to a certain number, then perform an action?

    for instance

    1. draw image
    2. count to 3
    3. delete image

  12. #9732
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Jmaxx Beitrag anzeigen
    How can you count to a certain number, then perform an action?

    for instance

    1. draw image
    2. count to 3
    3. delete image
    sceKernelDelayThread(3000 0); ?
    (without space)
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  13. #9733
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    I get this error when using: sceKernelDelayThread(3000 0);

    error: syntax error before numeric constant
    Geändert von Jmaxx (02-22-2009 um 12:08 PM Uhr)

  14. #9734
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Jmaxx Beitrag anzeigen
    I get this error when using: sceKernelDelayThread(3000 0);

    error: syntax error before numeric constant
    Did you remove the space: " " between the zeros?
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  15. #9735
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    I didn't realize that was what you were reffering to. Why did you put it there in the first place o.o?

  16. #9736
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Jmaxx Beitrag anzeigen
    I didn't realize that was what you were reffering to. Why did you put it there in the first place o.o?
    The forum did that
    I edited my message to let you know.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  17. #9737
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von basfreak Beitrag anzeigen
    So the best thing to do is create an array with the path and other squares and if a key is pressed change the array and re-configure the display list?
    No, I still don't think you follow. I'll take what my understanding is of what you aim to do, and we can work from there (even if I'm wrong, it'll give you a good idea of whats going on).

    First thing you do is initalise everything, then you create the display list, which will contain the map you've generated, and another display for your player (if its a complex set of vertices).

    Second, we call the map display list to the screen, followed by the players display list.

    Third, we move the player, call the map display list to the same spot and the player display list to the new spot.

    We never "re-configure" any part of the display list - ever. When you've done with that map we free the display list and create a new one, but you can't modify it on-the-fly. As I've said before, you should take a look at the OGL tutorials and work from there, they'll at least give you some base knowledge of what you're doing in 3D. You'll also get more support with OGL over PSPGU as Google will give you lots of guides/help/tutorials.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  18. #9738
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    No, I still don't think you follow. I'll take what my understanding is of what you aim to do, and we can work from there (even if I'm wrong, it'll give you a good idea of whats going on).

    First thing you do is initalise everything, then you create the display list, which will contain the map you've generated, and another display for your player (if its a complex set of vertices).

    Second, we call the map display list to the screen, followed by the players display list.

    Third, we move the player, call the map display list to the same spot and the player display list to the new spot.

    We never "re-configure" any part of the display list - ever. When you've done with that map we free the display list and create a new one, but you can't modify it on-the-fly. As I've said before, you should take a look at the OGL tutorials and work from there, they'll at least give you some base knowledge of what you're doing in 3D. You'll also get more support with OGL over PSPGU as Google will give you lots of guides/help/tutorials.

    -Aura
    Ok, I'm trying to follow tutorials of NeHe and some from videotutorialsrock.com .
    But if I now understand it right:
    • initialize
    • create display list for map
    • ,, for player
    • display map
    • display player
    • key pressed
    • move player (display list?)
    • display map
    • display moved player display list

    So I have to move the display list? Or should I move the Vertex.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  19. #9739
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    You move the coords that the players display list gets drawn to, the player gets drawn in the exact same way the only thing that changes is the place that its drawn.

    Also, I'm trying to make a backend for something, the universal method for backends seems to be:
    Code:
    blah --help
    
    Blah
    -o1 --option1 Option 1
    -o2 --option2 Option 2
          --option3 Option 3
    -h/? --help     display this message
    I'm just wondering if theres also a universal way of coding the calling section, or if any old method is used?

    -Aura
    Geändert von Auraomega (02-23-2009 um 07:32 AM Uhr)
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  20. #9740
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Well, hello there, got some problems with CLUT sample.

    Created two standalone functions, the initCLut and drawCLut to draw the CLUT image. It works.

    Then, i moved these two functions to the Class, map it's name, and now it doesn't work at all. The graphics are all scrawny, out of sync. i double checked, the functions are LITERALLY the same, and the makefile also contains the same flags.

    So, what i do now?
    FIle in the attachement.
    Angehängte Dateien Angehängte Dateien

  21. #9741
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Did those working examples include using OSL? I have a feeling thats whats screwing up the code (on a quick glance). I'm going to take a more in-depth look at it and see if I can spot anything else that may cause a problem.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  22. #9742
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Both working one and the one that i posted with classes use Oslib.
    I just can't see a difference 'xept the class wrap.
    Geändert von Netaro (02-23-2009 um 01:33 PM Uhr)

  23. #9743
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I'm not certain what the problem is as I can't test the code (no PSP), but the only suggest I can come up with is moving the testCLUTMap.initClut(); to inside the loop, I'm sure I read somewhere that you need to initalise the clut every time you draw if using OSL... but who knows? Just a suggestion.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  24. #9744
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    I'm not certain what the problem is as I can't test the code (no PSP), but the only suggest I can come up with is moving the testCLUTMap.initClut(); to inside the loop, I'm sure I read somewhere that you need to initalise the clut every time you draw if using OSL... but who knows? Just a suggestion.

    -Aura
    Well you don't :ROFL:
    -=Double Post Merge =-
    is it possible to use VLF to primt text over the XMB?
    Code:
    #include <pspsdk.h>
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>
    #include <pspsuspend.h>
    #include <psppower.h>
    #include <pspreg.h>
    #include <psprtc.h>
    #include <psputils.h>
    #include <pspgu.h>
    #include <pspgum.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdio.h>
    #include <stdarg.h>
    #include <malloc.h>
    
    #include <vlf.h>
    
    PSP_MODULE_INFO("XMB TEST", 0, 1, 0);
    PSP_MAIN_THREAD_ATTR(0);
    
    char text1 = "test from vlf prx";
    VlfText text;
    
    
    int app_main(int argc, char *argv[])
    {
    
    	
    	vlfGuiSystemSetup(1, 1, 1);		
    	vlfGuiAddText(1,5,"tEST");
    	while (1)
    	{
    		
    		text = vlfGuiAddText(1,50, &text1);
    		vlfGuiDrawFrame();
    	}
    	
    	return 0;
    }
    Geändert von slasher101 (02-24-2009 um 09:06 PM Uhr) Grund: Automerged Doublepost

  25. #9745
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    I'm not certain what the problem is as I can't test the code (no PSP), but the only suggest I can come up with is moving the testCLUTMap.initClut(); to inside the loop, I'm sure I read somewhere that you need to initalise the clut every time you draw if using OSL... but who knows? Just a suggestion.

    -Aura
    No, no, no, no, it doesn't work at all.

  26. #9746
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    http://www.megaupload.com/?d=NNVN7O6I

    Yup, another problem.
    It's about OSLIB's map system, but seeing what is the cause of the problem i think i'd need somebody explaining what is the difference.

    The problem is, the OSLIB's map system works by passing an array to the function (oslCreateMap(itsChipset, (void*)map,16,16,30,17,OS L_MF_U16); , where map is the chipset array)
    And now, the array is in the file (test.map), which has the array dimentions and the values.
    I read from file, and i put it in the array.

    When i use the ** array (dynamic two-dimentional) it doesn't work. Graphics are glitched (as in the already compiled file i provided).
    But when i make a unsigned short array[17][30]; it works (uncomment the specified lines in map.cpp).
    So, how can i make it work, as i don't think there should be any difference between two?

    Also, bump as i still can't figure out the clut sample (post above).

    Anybody willing to help?
    So, what shall i do to make it work?

  27. #9747
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    Anyone familiar with both Intel & AT&T assembly?

    How would you go from this Intel Assembly I believe to AT&T Gcc inline compatible?:

    __asm
    {
    loop_copy:
    instx86 128[ESI];
    ...more instructions
    jnz loop_copy;
    loop_copy_end:
    }

  28. #9748
    QJ Gamer Blue
    Points: 4.980, Level: 45
    Level completed: 15%, Points required for next Level: 170
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Chigasaki, Japan
    Beiträge
    226
    Points
    4.980
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Netaro Beitrag anzeigen
    When i use the ** array (dynamic two-dimentional) it doesn't work. Graphics are glitched (as in the already compiled file i provided).
    But when i make a unsigned short array[17][30]; it works (uncomment the specified lines in map.cpp).
    So, how can i make it work, as i don't think there should be any difference between two?
    They are not equivalent. The latter is a 2D-array of shorts while the first is an array of pointers to some base type (short I assume).

  29. #9749
    QJ Gamer Blue
    Points: 2.981, Level: 33
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    29
    Points
    2.981
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von kuroneko Beitrag anzeigen
    They are not equivalent. The latter is a 2D-array of shorts while the first is an array of pointers to some base type (short I assume).
    Well, i provided the source code, so you don't really have to assume, it's just there.
    And nope, ** can be used as 2d array, as in there -
    Code:
            unsigned short ** chipsetMap = new unsigned short*[mapHeight];
    
    	for(int i =0;i<mapHeight;i++){
    		chipsetMap[i] = new unsigned short[mapWidth];
    	}
    And it works the same as for example, lol[y][x] and chipsetMap[y][x], but somehow it's different in the works. But i don't see it, so how can i make it work?

  30. #9750
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    int map::createMap(char * filename){
        
    	std::fstream mapName(filename);
    	
    	mapName >> mapHeight >> mapWidth;
    
    	chipsetMap = new unsigned short*[mapHeight];
    
    	for(int i =0;i<mapHeight;i++){
    		chipsetMap[i] = new unsigned short[mapWidth];
    	}
    
    	for(int y=0;y<mapHeight;y++){
    		for(int x=0;x<mapWidth;x++){
    			//mapName >> hex >> lol[y][x];
    			mapName >> hex >> chipsetMap[y][x]; // Uncomment to check the dynamic array
    		}
    	}
    
    
    	itsChipset = oslLoadImageFilePNG("back.png", OSL_IN_RAM, OSL_PF_8888);
    
    	//itsMap = oslCreateMap(itsChipset,(void*)lol,16,16,30,17,OSL_MF_U16); // WORKS PARTIALLY, and that what i don't want to do.
    	//itsMap = oslCreateMap(itsChipset,(void*)galaxy_map,16,16,30,17,OSL_MF_U16); // WORKS, but that's not what i want
    	itsMap = oslCreateMap(itsChipset,(void*)chipsetMap,16,16,30,17,OSL_MF_U16); // DOESN'T WORK, and i want that to work
    
    	mapName.close();
    	return 1;
    }
    Have you checked the values of mapWidth and mapHeight when you read it from the file to see if they are correct?

    Edit: I just checked the code and data and I am going to chalk it up to 'undefined error'. You are trying to read past the end of the file. The map is NOT 17 units in height but 1 yet you are trying to 17 * 30 numbers when there is only 30.


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:27 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .