Commit 804d4f2c authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Disable drop shadow when using translucency

Detail:
  s/StartUp - By popular demand, automatically disable the drop shadow when we're performing a translucent drag, as general opinion seems to be that translucent drags will look better without it. Reportedly this also matches the behaviour of ROL's version of the module.
Admin:
  Tested on BB-xM


Version 0.17. Tagged as 'DragASprit-0_17'
parent 92e1b728
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.16"
Module_Version SETA 16
Module_MajorVersion SETS "0.17"
Module_Version SETA 17
Module_MinorVersion SETS ""
Module_Date SETS "07 Oct 2013"
Module_ApplicationDate SETS "07-Oct-13"
Module_Date SETS "15 Oct 2013"
Module_ApplicationDate SETS "15-Oct-13"
Module_ComponentName SETS "DragASprit"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/DragASprit"
Module_FullVersion SETS "0.16"
Module_HelpVersion SETS "0.16 (07 Oct 2013)"
Module_FullVersion SETS "0.17"
Module_HelpVersion SETS "0.17 (15 Oct 2013)"
END
/* (0.16)
/* (0.17)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.16
#define Module_MajorVersion_CMHG 0.17
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 07 Oct 2013
#define Module_Date_CMHG 15 Oct 2013
#define Module_MajorVersion "0.16"
#define Module_Version 16
#define Module_MajorVersion "0.17"
#define Module_Version 17
#define Module_MinorVersion ""
#define Module_Date "07 Oct 2013"
#define Module_Date "15 Oct 2013"
#define Module_ApplicationDate "07-Oct-13"
#define Module_ApplicationDate "15-Oct-13"
#define Module_ComponentName "DragASprit"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/DragASprit"
#define Module_FullVersion "0.16"
#define Module_HelpVersion "0.16 (07 Oct 2013)"
#define Module_LibraryVersionInfo "0:16"
#define Module_FullVersion "0.17"
#define Module_HelpVersion "0.17 (15 Oct 2013)"
#define Module_LibraryVersionInfo "0:17"
......@@ -71,7 +71,7 @@ hatching SETL 1=1
DS_DropShadowDistance * 8 ; OS units
DS_TranslucencyValue * 128 ; i.e. 50%, as per hatching
DS_TranslucencyValue_256 * 104 ; Use a value of about 40% in 256 colour modes. With the default Wimp theme sprites this greatly helps file icons to retain their colour when dragged over window & desktop backgrounds.
DS_TranslucencyValue_256 * 104 ; Use a value of about 40% in 256 colour modes. With the default RISC OS 5 Wimp theme sprites this greatly helps file icons to retain their colour when dragged over window & desktop backgrounds.
MACRO
$label TestAFlag $reg, $what, $iswhat, $workreg
......@@ -85,6 +85,7 @@ dragstr # dr_size
scale_block # 16
tx_block # 16
spr_dragbox # 16 ; Box to use for sprite dragging calculations
local_flags # 4
StartUp_frame_size * :INDEX: @
StartUp Entry "r0-r8", StartUp_frame_size
......@@ -106,6 +107,8 @@ StartUp Entry "r0-r8", StartUp_frame_size
BL Done ; Junk any drag pending at the moment
BVS %FT90
STR R0, local_flags
; ensure the box passed in is rounded to osunits
STMFD R13!,{R0-R2} ; save R0-R2
......@@ -116,6 +119,46 @@ StartUp Entry "r0-r8", StartUp_frame_size
MOV R1, #VduExt_YEigFactor
SWI XOS_ReadModeVariable
MOV R8, R2 ; R8 is the yeig factor
; If we want to use translucency, set the translucency value and massage the flags as appropriate
MOV LR, #0
STRB LR, Translucency
LDR LR, local_flags + 3*4
TST LR, #DS_NoHatching
BNE %FT02
; Check SpriteExtend version if we're not sure yet
; (ROM init order means that checking on startup won't work)
LDRB R0, TranslucencyOK
CMP R0, #128
BNE %FT01
ADRL R0, SpriteExtendCheck
SWI XOS_CLI
MOVVC R0, #255
MOVVS R0, #0
CLRV
STRB R0, TranslucencyOK
01
; Work out translucency value to use for current screen mode
MOV R0, #-1
MOV R1, #VduExt_Log2BPP
SWI XOS_ReadModeVariable
TEQ R2, #3
MOVEQ LR, #DS_TranslucencyValue_256
MOVNE LR, #DS_TranslucencyValue
; If translucency available, and we've got more than 2 colours to play
; with, prefer that over hatching
TEQ R2, #0
LDRNEB R2, TranslucencyOK
ANDNES R2, R2, LR
BEQ %FT02
STRB R2, Translucency
LDR R0, local_flags + 3*4
; Disable hatching + dropshadow (drop shadow is possible, but general opinion is that it looks better without when translucency is in use)
ORR R0, R0, #DS_NoHatching
BIC R0, R0, #DS_DropShadow_Mask
STR R0, local_flags + 3*4
02
LDMFD R13!,{R0-R2} ; recover the registers we've messed up
MOV R6, #1 ; a handy constant for shifts
......@@ -157,7 +200,7 @@ StartUp Entry "r0-r8", StartUp_frame_size
BVS ResortToNormalDrag
; If there's a drop-shadow grow the size by the required distance
LDR r2, [sp, #Proc_LocalStack + 0*4]
LDR r2, local_flags
TestAFlag r2, DropShadow, Present, r14
ADDEQ r0, r0, #DS_DropShadowDistance
ADDEQ r1, r1, #DS_DropShadowDistance
......@@ -304,9 +347,9 @@ wibble
BVC %FT05 ; masks fail on first version of Medusa
; so try and carry on drag solidly.
; make sure dithering disabled- doesn't look good!
LDR R0, [sp, #Proc_LocalStack + 0*4]
LDR R0, local_flags
ORR R0,R0, #DS_NoHatching
STR R0, [sp, #Proc_LocalStack + 0*4]
STR R0, local_flags
; Switch output to the sprite
MOV r0, #SpriteReason_SwitchOutputToSprite + &100
......@@ -346,7 +389,7 @@ wibble
BVS %FT70
; Test for drop-shadow
LDR r0, [sp, #4*4 + Proc_LocalStack + 0*4]
LDR r0, local_flags + 4*4
TestAFlag r0, DropShadow, Present, r14
; Load up common parameters
......@@ -393,7 +436,7 @@ wibble
Push "r0-r3"
35
; Test for drop shadow
LDR r0, [sp, #4*4 + Proc_LocalStack + 0*4]
LDR r0, local_flags + 4*4
TestAFlag r0, DropShadow, Present, r14
; Load up the common parameters
......@@ -474,34 +517,10 @@ wibble2
;; you can see all alternate pixels.
[ hatching
LDR R0, [sp, #Proc_LocalStack + 0*4]
LDR R0, local_flags
TST R0, #DS_NoHatching
BNE %FT53 ; if no hatching then skip
; Check SpriteExtend version if we're not sure yet
; (ROM init order means that checking on startup won't work)
LDRB R0,TranslucencyOK
CMP R0,#128
BNE %FT09
ADRL R0,SpriteExtendCheck
SWI XOS_CLI
MOVVC R0,#255
MOVVS R0,#0
CLRV
STRB R0,TranslucencyOK
09
; Work out translucency value to use for current screen mode
TEQ R8,#3
MOVEQ LR,#DS_TranslucencyValue_256
MOVNE LR,#DS_TranslucencyValue
; If translucency available, and we've got more than 2 colours to play
; with, prefer that over hatching
MOVS R3,R8
LDRNEB R3,TranslucencyOK
ANDNES R3,R3,LR
STRB R3,Translucency
BNE %FT53
MOV R3,#0
CMP R7,#31
MOVGT R3,R7, LSR #8
......@@ -615,7 +634,7 @@ wibble2
STR r14, dragstr + dr_type
; Calculate the offset from box to sprite
LDR r0, [sp, #Proc_LocalStack + 0*4]
LDR r0, local_flags
LDR r3, [sp, #Proc_LocalStack + 3*4]
[ AtPointerFlag
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment