Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Yankes

Pages: 1 ... 208 209 [210] 211
3136
Programming / Re: Code problems
« on: August 16, 2011, 01:16:22 pm »
The malloc I copied that from Palette::loadDat ... not sure why it's used, I guess it's more C-like which fits SDL, maybe it's from an example in the SDL tutorials?
AFIK is no difference between `malloc` and `new` when its used with C structures. i think is better to stick to C++ functions.
paletteShift is always called once and then paletteRestore after that, so currently there are no memory leaks. But you are right, if someone else wants to use this function it should be made a little more foolproof.
exactly
About the "mul", I'm not sure how that works, I copied it from the original function Surface::offset, and it seemed to me it still works?
probably this function is right, its implementation is bizarre for me.

3137
Programming / Code problems
« on: August 16, 2011, 04:11:24 am »
I looked in OpenXcom code and i have problem with it :)

`Surface::paletteShift` <- i dont like this function

we have this:
Code: [Select]
https:// store the original palette
_originalColors = (SDL_Color *)malloc(sizeof(SDL_Color) * _surface->format->palette->ncolors);
1) couple of points:
a) why malloc? not beter use `new SDL_Color[_surface->format->palette->ncolors];`?
b) why isnt null assert here? when we call 2 times this function, we will get memory leak.
c) destructor dont delete this memory -> memory leak
d) copy constructor dont copy this

Code: [Select]
if (i * mul + off < _surface->format->palette->ncolors)
{
newColors[i].r = getPalette()[i * mul + off].r;
newColors[i].g = getPalette()[i * mul + off].g;
newColors[i].b = getPalette()[i * mul + off].b;
}
2) is indented that`mul>1` will leave half of colors in palette black?
Code: [Select]
if (_originalColors)
{
SDL_SetColors(_surface, _originalColors, 0, 256);
free(_originalColors);
_originalColors = 0;
}
3) `Surface::paletteRestore()` have fixed size 256, this is indented? in `Surface::paletteShift` the ` _surface->format->palette->ncolors` is used. is possible to have less than 256 in normal palette?

3138
Programming / Re: Battlescape performance
« on: August 15, 2011, 05:36:54 pm »
i find bug in new cache tiles, when titles are change off screan, they stay in previous state. best way to reproduce it is chare your solder to alien and kill him away from rest of your squad.
next when you want see place where he died, you can see not updated titles, you need move cursor over them to update them
[ps]
now i have idle: 420 move: 350
older  idle: 340 move: 130


3139
Programming / Re: Battlescape performance
« on: August 15, 2011, 04:31:17 pm »
Been experimenting with dirty rectangles, so far it just gives me loads of artifacts :)
alien artifacts ? :)

i think a bit about this `Z-buffer`. probably best solution is add new surface that will store this as white color byte.
to draw something you will need call that pseudo code:
Code: [Select]
int currZ;
int buffZ[n][k];
color buffDraw[n][k];
color tile[tile_h][tile_w];
int x,y;
for(i=0; i<tile_h; ++i)
    for(j=0; j<tile_w; ++j)
    {
        if(tile[i][j] != transparent && buffZ[x+i][y+j]<currZ)
        {
            buffDraw[x+i][y+j] = tile[i][j];
            buffZ[x+i][y+j] = currZ;
        }
    }
i think this will be more slow than current solution, because of this `if` and need of drawing every pixel separate.

3140
Programming / Battlescape performance
« on: August 14, 2011, 08:39:01 pm »
i dont think that will help much. when you move solder in dark, every tiles change its light amount. this will cause more than half screen force to update, and probably number of calls of setPalette dont change.

but it would be possible to group object that have same palette? and draw them at once? it will have problems with position, but using some kind of Z-buffer will probably solve most of problems.

3141
Programming / Battlescape performance
« on: August 14, 2011, 04:14:31 am »
bug a was probably caused by the caching of the tiles. I removed caching (the shading effect is now done with palette tricks), and as a result this bug is also fixed :)

.
btw in last build moving animation slowed down, FPS counter drop from 300 to 150 when i moved my solder. after move ends it goes back to 300

3142
Suggestions / Re: Blood stains
« on: August 13, 2011, 02:48:58 pm »
not if we treat blood like items, then we would need only couple new sprites for every blood type (and maybe size).
alternative create new layer over floor (and under walls, items and objects) that will be used to draw blood (and oil form tanks :D

3143
Suggestions / Blood stains
« on: August 12, 2011, 07:24:32 pm »
i think that would be fun if solders/aliens leave blood stains on ground when they are wound or when they are hit (of coarse different colors stains :> )
you could track wounded ones by looking on trace they left behind.

only problem with that is stains should be updated only when you unit see them.

3144
Suggestions / Re: Autocombat
« on: July 30, 2011, 03:38:50 pm »
it wont work, this is because you cant replace easy your solders. how you will balance win/loose ratio (and kill/death ratio)? if you are skilled you can conquer alien base with one solder with L-pistol, but sometimes you whole squad can die from one alien.
you will probably not glad when your Jon Rambo MIA in attack on small scout :)

3145
Builds & Ports / Re: Android Port
« on: July 24, 2011, 10:07:09 pm »
i find this in google: https://sourceforge.net/projects/sdljava/ and AFIK (probaby its wrong :D) YAML is only for writing XML and can be replased by any other xml lib.
and because OpenXcom dont use any advanced C++ features (again AFIK from a short look in code) is can be easy copy/pasted to Java :) (its can be even more correct because you dont need use `delete` that can be pain in a** when you made mistaken)

3146
Programming / Re: Ufopaedia development
« on: June 25, 2011, 10:52:04 pm »
You need yaml-cpp 0.2.6, though if you're not using the load/save functionality you can probably just comment out those lines with little issue.

btw i tried to compile openxcom under MinGW using
https://openxcom.ninex.info/download/misc/openxcom-deps-win32-mingw.zip
but i got this error too in yaml, this mean this "deps" are outdated.

3147
Suggestions / Re: realistic fires
« on: May 30, 2011, 11:35:58 pm »
"I love the smell of Napalm in the morning" :D

3148
Suggestions / Re: Cryssalids & zombie mission
« on: May 26, 2011, 09:09:35 pm »
maybe this minsia will spawn only when you ignore or loose terror mission with Snakemen? and after couple of day will appear new terror mission in that same place but now you will fight only zombie and Chryssalids.

3149
Suggestions / Re: other psionic powers
« on: May 24, 2011, 08:24:56 pm »
 i would  prefer simple PSI powers, not some magic system :)

i prefer something like that:

mind blast - inflict big amount of pain to target
force grip (:D) - deal dmg to target
blind - blind :)
telekinetic - allow remotely detonate bombs

and good idea is to use energy bar to limit usage of PSI powers.

3150
Offtopic / Re: Daiky's x-com project
« on: May 03, 2011, 04:07:49 am »
Daiky i find something that can interested you:
https://www.youtube.com/user/AtomontageEngine#p/a/u/1/n2qkne-EOG8
in this engine you should be able to create full level from LOF-templates :)

Pages: 1 ... 208 209 [210] 211