diff options
author | Stijn Buys <ingar@osirion.org> | 2010-09-15 21:29:18 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-09-15 21:29:18 +0000 |
commit | e55638d081e2e1ff6fbc06e0e8ac0381a04308e7 (patch) | |
tree | 511ccb478adf2acd3cc93f66d217b09f3e3a06dc /src/render | |
parent | f612f19e095b8d0ba49f5bcdec6a582824315d69 (diff) |
updated comments, updated buy menu, info support for map window, added const to target selection
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 2 | ||||
-rw-r--r-- | src/render/draw.h | 2 | ||||
-rw-r--r-- | src/render/tgafile.cc | 15 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 9e6bb5a..7d0242d 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -1344,7 +1344,7 @@ void draw(float seconds) } // draw HUD target world space geometry, like dock indicators -void draw_target(core::Entity *entity) +void draw_target(const core::Entity *entity) { model::Model *model = entity->model(); if (!model) diff --git a/src/render/draw.h b/src/render/draw.h index b13c7b0..54e8507 100644 --- a/src/render/draw.h +++ b/src/render/draw.h @@ -18,7 +18,7 @@ namespace render /// draw the world void draw(float seconds); -void draw_target(core::Entity *entity); +void draw_target(const core::Entity *entity); /// reset void reset(); diff --git a/src/render/tgafile.cc b/src/render/tgafile.cc index db54645..10082e6 100644 --- a/src/render/tgafile.cc +++ b/src/render/tgafile.cc @@ -270,20 +270,20 @@ void TGA::save(const char *filename, Image & image) pixel_data[3] = *image[index+3]; if (block_length == 0) { + // if the block is empty, copy the first pixel memcpy(block_data, pixel_data, image.channels()); block_length++; + // by default, the block is not compressed compress = false; } else { + // if the current block is not compressed if (!compress) { - - // uncompressed block and pixel_data differs from the last pixel + // if the previous pixel differs from the pixel data if (memcmp(&block_data[(block_length-1)*image.channels()], pixel_data, image.channels()) != 0) { // append pixel memcpy(&block_data[block_length*image.channels()], pixel_data, image.channels()); - block_length++; } else { - // uncompressed block and pixel data is identical if (block_length > 1) { // write the uncompressed block @@ -292,17 +292,16 @@ void TGA::save(const char *filename, Image & image) ofs.write((char *)block_data, (block_length - 1) * image.channels()); block_length = 1; } + // create a commpressed block memcpy(block_data, pixel_data, image.channels()); block_length++; compress = true; } - + // if the current block is compressed } else { - - // compressed block and pixel data are identical + // if the previous pixel and the pixel data are identical if (memcmp(block_data, pixel_data, image.channels()) == 0) { block_length++; - } else { // compressed block and pixel data differs |